// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate api;
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate gtype;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate rpc;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Encodes the detailed information of a barcode.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Barcode {
    /// Format of a barcode.
    /// The supported formats are:
    ///
    /// - `CODE_128`: Code 128 type.
    /// - `CODE_39`: Code 39 type.
    /// - `CODE_93`: Code 93 type.
    /// - `CODABAR`: Codabar type.
    /// - `DATA_MATRIX`: 2D Data Matrix type.
    /// - `ITF`: ITF type.
    /// - `EAN_13`: EAN-13 type.
    /// - `EAN_8`: EAN-8 type.
    /// - `QR_CODE`: 2D QR code type.
    /// - `UPC_A`: UPC-A type.
    /// - `UPC_E`: UPC-E type.
    /// - `PDF417`: PDF417 type.
    /// - `AZTEC`: 2D Aztec code type.
    /// - `DATABAR`: GS1 DataBar code type.
    pub format: std::string::String,

    /// Value format describes the format of the value that a barcode
    /// encodes.
    /// The supported formats are:
    ///
    /// - `CONTACT_INFO`: Contact information.
    /// - `EMAIL`: Email address.
    /// - `ISBN`: ISBN identifier.
    /// - `PHONE`: Phone number.
    /// - `PRODUCT`: Product.
    /// - `SMS`: SMS message.
    /// - `TEXT`: Text string.
    /// - `URL`: URL address.
    /// - `WIFI`: Wifi information.
    /// - `GEO`: Geo-localization.
    /// - `CALENDAR_EVENT`: Calendar event.
    /// - `DRIVER_LICENSE`: Driver's license.
    pub value_format: std::string::String,

    /// Raw value encoded in the barcode.
    /// For example: `'MEBKM:TITLE:Google;URL:<https://www.google.com>;;'`.
    pub raw_value: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Barcode {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [format][crate::model::Barcode::format].
    pub fn set_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.format = v.into();
        self
    }

    /// Sets the value of [value_format][crate::model::Barcode::value_format].
    pub fn set_value_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.value_format = v.into();
        self
    }

    /// Sets the value of [raw_value][crate::model::Barcode::raw_value].
    pub fn set_raw_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.raw_value = v.into();
        self
    }
}

impl wkt::message::Message for Barcode {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.Barcode"
    }
}

/// Document represents the canonical document resource in Document AI. It is an
/// interchange format that provides insights into documents and allows for
/// collaboration between users and Document AI to iterate and optimize for
/// quality.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Document {
    /// Optional. An internal identifier for document. Should be loggable (no PII).
    pub docid: std::string::String,

    /// An IANA published [media type (MIME
    /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
    pub mime_type: std::string::String,

    /// Optional. UTF-8 encoded text in reading order from the document.
    pub text: std::string::String,

    /// Styles for the [Document.text][google.cloud.documentai.v1.Document.text].
    ///
    /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
    #[deprecated]
    pub text_styles: std::vec::Vec<crate::model::document::Style>,

    /// Visual page layout for the [Document][google.cloud.documentai.v1.Document].
    ///
    /// [google.cloud.documentai.v1.Document]: crate::model::Document
    pub pages: std::vec::Vec<crate::model::document::Page>,

    /// A list of entities detected on
    /// [Document.text][google.cloud.documentai.v1.Document.text]. For document
    /// shards, entities in this list may cross shard boundaries.
    ///
    /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
    pub entities: std::vec::Vec<crate::model::document::Entity>,

    /// Placeholder.  Relationship among
    /// [Document.entities][google.cloud.documentai.v1.Document.entities].
    ///
    /// [google.cloud.documentai.v1.Document.entities]: crate::model::Document::entities
    pub entity_relations: std::vec::Vec<crate::model::document::EntityRelation>,

    /// Placeholder.  A list of text corrections made to
    /// [Document.text][google.cloud.documentai.v1.Document.text].  This is usually
    /// used for annotating corrections to OCR mistakes.  Text changes for a given
    /// revision may not overlap with each other.
    ///
    /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
    pub text_changes: std::vec::Vec<crate::model::document::TextChange>,

    /// Information about the sharding if this document is sharded part of a larger
    /// document. If the document is not sharded, this message is not specified.
    pub shard_info: std::option::Option<crate::model::document::ShardInfo>,

    /// Any error that occurred while processing this document.
    pub error: std::option::Option<rpc::model::Status>,

    /// Placeholder. Revision history of this document.
    pub revisions: std::vec::Vec<crate::model::document::Revision>,

    /// Parsed layout of the document.
    pub document_layout: std::option::Option<crate::model::document::DocumentLayout>,

    /// Document chunked based on chunking config.
    pub chunked_document: std::option::Option<crate::model::document::ChunkedDocument>,

    /// The entity validation output for the document. This is the validation
    /// output for `document.entities` field.
    pub entity_validation_output:
        std::option::Option<crate::model::document::EntityValidationOutput>,

    /// A list of entity revisions. The entity revisions are appended to the
    /// document in the processing order. This field can be used for comparing the
    /// entity extraction results at different stages of the processing.
    pub entities_revisions: std::vec::Vec<crate::model::document::EntitiesRevision>,

    /// The entity revision id that `document.entities` field is based on.
    /// If this field is set and `entities_revisions` is not empty, the entities in
    /// `document.entities` field are the entities in the entity revision with this
    /// id and `document.entity_validation_output` field is the
    /// `entity_validation_output` field in this entity revision.
    pub entities_revision_id: std::string::String,

    /// Original source document from the user.
    pub source: std::option::Option<crate::model::document::Source>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Document {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [docid][crate::model::Document::docid].
    pub fn set_docid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.docid = v.into();
        self
    }

    /// Sets the value of [mime_type][crate::model::Document::mime_type].
    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.mime_type = v.into();
        self
    }

    /// Sets the value of [text][crate::model::Document::text].
    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.text = v.into();
        self
    }

    /// Sets the value of [text_styles][crate::model::Document::text_styles].
    #[deprecated]
    pub fn set_text_styles<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::document::Style>,
    {
        use std::iter::Iterator;
        self.text_styles = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [pages][crate::model::Document::pages].
    pub fn set_pages<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::document::Page>,
    {
        use std::iter::Iterator;
        self.pages = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [entities][crate::model::Document::entities].
    pub fn set_entities<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::document::Entity>,
    {
        use std::iter::Iterator;
        self.entities = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [entity_relations][crate::model::Document::entity_relations].
    pub fn set_entity_relations<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::document::EntityRelation>,
    {
        use std::iter::Iterator;
        self.entity_relations = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [text_changes][crate::model::Document::text_changes].
    pub fn set_text_changes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::document::TextChange>,
    {
        use std::iter::Iterator;
        self.text_changes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [shard_info][crate::model::Document::shard_info].
    pub fn set_shard_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::document::ShardInfo>,
    {
        self.shard_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [shard_info][crate::model::Document::shard_info].
    pub fn set_or_clear_shard_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::document::ShardInfo>,
    {
        self.shard_info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [error][crate::model::Document::error].
    pub fn set_error<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<rpc::model::Status>,
    {
        self.error = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [error][crate::model::Document::error].
    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<rpc::model::Status>,
    {
        self.error = v.map(|x| x.into());
        self
    }

    /// Sets the value of [revisions][crate::model::Document::revisions].
    pub fn set_revisions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::document::Revision>,
    {
        use std::iter::Iterator;
        self.revisions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [document_layout][crate::model::Document::document_layout].
    pub fn set_document_layout<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::document::DocumentLayout>,
    {
        self.document_layout = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [document_layout][crate::model::Document::document_layout].
    pub fn set_or_clear_document_layout<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::document::DocumentLayout>,
    {
        self.document_layout = v.map(|x| x.into());
        self
    }

    /// Sets the value of [chunked_document][crate::model::Document::chunked_document].
    pub fn set_chunked_document<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::document::ChunkedDocument>,
    {
        self.chunked_document = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [chunked_document][crate::model::Document::chunked_document].
    pub fn set_or_clear_chunked_document<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::document::ChunkedDocument>,
    {
        self.chunked_document = v.map(|x| x.into());
        self
    }

    /// Sets the value of [entity_validation_output][crate::model::Document::entity_validation_output].
    pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::document::EntityValidationOutput>,
    {
        self.entity_validation_output = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [entity_validation_output][crate::model::Document::entity_validation_output].
    pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::document::EntityValidationOutput>,
    {
        self.entity_validation_output = v.map(|x| x.into());
        self
    }

    /// Sets the value of [entities_revisions][crate::model::Document::entities_revisions].
    pub fn set_entities_revisions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::document::EntitiesRevision>,
    {
        use std::iter::Iterator;
        self.entities_revisions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [entities_revision_id][crate::model::Document::entities_revision_id].
    pub fn set_entities_revision_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.entities_revision_id = v.into();
        self
    }

    /// Sets the value of [source][crate::model::Document::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<
        T: std::convert::Into<std::option::Option<crate::model::document::Source>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::Document::source]
    /// if it holds a `Uri`, `None` if the field is not set or
    /// holds a different branch.
    pub fn uri(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::document::Source::Uri(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::Document::source]
    /// to hold a `Uri`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.source = std::option::Option::Some(crate::model::document::Source::Uri(v.into()));
        self
    }

    /// The value of [source][crate::model::Document::source]
    /// if it holds a `Content`, `None` if the field is not set or
    /// holds a different branch.
    pub fn content(&self) -> std::option::Option<&::bytes::Bytes> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::document::Source::Content(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::Document::source]
    /// to hold a `Content`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.source = std::option::Option::Some(crate::model::document::Source::Content(v.into()));
        self
    }
}

impl wkt::message::Message for Document {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.Document"
    }
}

/// Defines additional types related to [Document].
pub mod document {
    #[allow(unused_imports)]
    use super::*;

    /// For a large document, sharding may be performed to produce several
    /// document shards. Each document shard contains this field to detail which
    /// shard it is.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct ShardInfo {
        /// The 0-based index of this shard.
        pub shard_index: i64,

        /// Total number of shards.
        pub shard_count: i64,

        /// The index of the first character in
        /// [Document.text][google.cloud.documentai.v1.Document.text] in the overall
        /// document global text.
        ///
        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
        pub text_offset: i64,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl ShardInfo {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [shard_index][crate::model::document::ShardInfo::shard_index].
        pub fn set_shard_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
            self.shard_index = v.into();
            self
        }

        /// Sets the value of [shard_count][crate::model::document::ShardInfo::shard_count].
        pub fn set_shard_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
            self.shard_count = v.into();
            self
        }

        /// Sets the value of [text_offset][crate::model::document::ShardInfo::text_offset].
        pub fn set_text_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
            self.text_offset = v.into();
            self
        }
    }

    impl wkt::message::Message for ShardInfo {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.ShardInfo"
        }
    }

    /// Annotation for common text style attributes. This adheres to CSS
    /// conventions as much as possible.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Style {
        /// Text anchor indexing into the
        /// [Document.text][google.cloud.documentai.v1.Document.text].
        ///
        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
        pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,

        /// Text color.
        pub color: std::option::Option<gtype::model::Color>,

        /// Text background color.
        pub background_color: std::option::Option<gtype::model::Color>,

        /// [Font weight](https://www.w3schools.com/cssref/pr_font_weight.asp).
        /// Possible values are `normal`, `bold`, `bolder`, and `lighter`.
        pub font_weight: std::string::String,

        /// [Text style](https://www.w3schools.com/cssref/pr_font_font-style.asp).
        /// Possible values are `normal`, `italic`, and `oblique`.
        pub text_style: std::string::String,

        /// [Text
        /// decoration](https://www.w3schools.com/cssref/pr_text_text-decoration.asp).
        /// Follows CSS standard. \<text-decoration-line\> \<text-decoration-color\>
        /// \<text-decoration-style\>
        pub text_decoration: std::string::String,

        /// Font size.
        pub font_size: std::option::Option<crate::model::document::style::FontSize>,

        /// Font family such as `Arial`, `Times New Roman`.
        /// <https://www.w3schools.com/cssref/pr_font_font-family.asp>
        pub font_family: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Style {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [text_anchor][crate::model::document::Style::text_anchor].
        pub fn set_text_anchor<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::TextAnchor>,
        {
            self.text_anchor = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [text_anchor][crate::model::document::Style::text_anchor].
        pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::TextAnchor>,
        {
            self.text_anchor = v.map(|x| x.into());
            self
        }

        /// Sets the value of [color][crate::model::document::Style::color].
        pub fn set_color<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<gtype::model::Color>,
        {
            self.color = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [color][crate::model::document::Style::color].
        pub fn set_or_clear_color<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<gtype::model::Color>,
        {
            self.color = v.map(|x| x.into());
            self
        }

        /// Sets the value of [background_color][crate::model::document::Style::background_color].
        pub fn set_background_color<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<gtype::model::Color>,
        {
            self.background_color = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [background_color][crate::model::document::Style::background_color].
        pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<gtype::model::Color>,
        {
            self.background_color = v.map(|x| x.into());
            self
        }

        /// Sets the value of [font_weight][crate::model::document::Style::font_weight].
        pub fn set_font_weight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.font_weight = v.into();
            self
        }

        /// Sets the value of [text_style][crate::model::document::Style::text_style].
        pub fn set_text_style<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.text_style = v.into();
            self
        }

        /// Sets the value of [text_decoration][crate::model::document::Style::text_decoration].
        pub fn set_text_decoration<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.text_decoration = v.into();
            self
        }

        /// Sets the value of [font_size][crate::model::document::Style::font_size].
        pub fn set_font_size<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::style::FontSize>,
        {
            self.font_size = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [font_size][crate::model::document::Style::font_size].
        pub fn set_or_clear_font_size<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::style::FontSize>,
        {
            self.font_size = v.map(|x| x.into());
            self
        }

        /// Sets the value of [font_family][crate::model::document::Style::font_family].
        pub fn set_font_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.font_family = v.into();
            self
        }
    }

    impl wkt::message::Message for Style {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.Style"
        }
    }

    /// Defines additional types related to [Style].
    pub mod style {
        #[allow(unused_imports)]
        use super::*;

        /// Font size with unit.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct FontSize {
            /// Font size for the text.
            pub size: f32,

            /// Unit for the font size. Follows CSS naming (such as `in`, `px`, and
            /// `pt`).
            pub unit: std::string::String,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl FontSize {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [size][crate::model::document::style::FontSize::size].
            pub fn set_size<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
                self.size = v.into();
                self
            }

            /// Sets the value of [unit][crate::model::document::style::FontSize::unit].
            pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
                self.unit = v.into();
                self
            }
        }

        impl wkt::message::Message for FontSize {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Style.FontSize"
            }
        }
    }

    /// A page in a [Document][google.cloud.documentai.v1.Document].
    ///
    /// [google.cloud.documentai.v1.Document]: crate::model::Document
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Page {
        /// 1-based index for current
        /// [Page][google.cloud.documentai.v1.Document.Page] in a parent
        /// [Document][google.cloud.documentai.v1.Document]. Useful when a page is
        /// taken out of a [Document][google.cloud.documentai.v1.Document] for
        /// individual processing.
        ///
        /// [google.cloud.documentai.v1.Document]: crate::model::Document
        /// [google.cloud.documentai.v1.Document.Page]: crate::model::document::Page
        pub page_number: i32,

        /// Rendered image for this page. This image is preprocessed to remove any
        /// skew, rotation, and distortions such that the annotation bounding boxes
        /// can be upright and axis-aligned.
        pub image: std::option::Option<crate::model::document::page::Image>,

        /// Transformation matrices that were applied to the original document image
        /// to produce [Page.image][google.cloud.documentai.v1.Document.Page.image].
        ///
        /// [google.cloud.documentai.v1.Document.Page.image]: crate::model::document::Page::image
        pub transforms: std::vec::Vec<crate::model::document::page::Matrix>,

        /// Physical dimension of the page.
        pub dimension: std::option::Option<crate::model::document::page::Dimension>,

        /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page.
        ///
        /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
        pub layout: std::option::Option<crate::model::document::page::Layout>,

        /// A list of detected languages together with confidence.
        pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,

        /// A list of visually detected text blocks on the page.
        /// A block has a set of lines (collected into paragraphs) that have a common
        /// line-spacing and orientation.
        pub blocks: std::vec::Vec<crate::model::document::page::Block>,

        /// A list of visually detected text paragraphs on the page.
        /// A collection of lines that a human would perceive as a paragraph.
        pub paragraphs: std::vec::Vec<crate::model::document::page::Paragraph>,

        /// A list of visually detected text lines on the page.
        /// A collection of tokens that a human would perceive as a line.
        pub lines: std::vec::Vec<crate::model::document::page::Line>,

        /// A list of visually detected tokens on the page.
        pub tokens: std::vec::Vec<crate::model::document::page::Token>,

        /// A list of detected non-text visual elements e.g. checkbox,
        /// signature etc. on the page.
        pub visual_elements: std::vec::Vec<crate::model::document::page::VisualElement>,

        /// A list of visually detected tables on the page.
        pub tables: std::vec::Vec<crate::model::document::page::Table>,

        /// A list of visually detected form fields on the page.
        pub form_fields: std::vec::Vec<crate::model::document::page::FormField>,

        /// A list of visually detected symbols on the page.
        pub symbols: std::vec::Vec<crate::model::document::page::Symbol>,

        /// A list of detected barcodes.
        pub detected_barcodes: std::vec::Vec<crate::model::document::page::DetectedBarcode>,

        /// Image quality scores.
        pub image_quality_scores:
            std::option::Option<crate::model::document::page::ImageQualityScores>,

        /// The history of this page.
        #[deprecated]
        pub provenance: std::option::Option<crate::model::document::Provenance>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Page {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [page_number][crate::model::document::Page::page_number].
        pub fn set_page_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.page_number = v.into();
            self
        }

        /// Sets the value of [image][crate::model::document::Page::image].
        pub fn set_image<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::page::Image>,
        {
            self.image = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [image][crate::model::document::Page::image].
        pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::page::Image>,
        {
            self.image = v.map(|x| x.into());
            self
        }

        /// Sets the value of [transforms][crate::model::document::Page::transforms].
        pub fn set_transforms<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page::Matrix>,
        {
            use std::iter::Iterator;
            self.transforms = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [dimension][crate::model::document::Page::dimension].
        pub fn set_dimension<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::page::Dimension>,
        {
            self.dimension = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [dimension][crate::model::document::Page::dimension].
        pub fn set_or_clear_dimension<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::page::Dimension>,
        {
            self.dimension = v.map(|x| x.into());
            self
        }

        /// Sets the value of [layout][crate::model::document::Page::layout].
        pub fn set_layout<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::page::Layout>,
        {
            self.layout = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [layout][crate::model::document::Page::layout].
        pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::page::Layout>,
        {
            self.layout = v.map(|x| x.into());
            self
        }

        /// Sets the value of [detected_languages][crate::model::document::Page::detected_languages].
        pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
        {
            use std::iter::Iterator;
            self.detected_languages = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [blocks][crate::model::document::Page::blocks].
        pub fn set_blocks<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page::Block>,
        {
            use std::iter::Iterator;
            self.blocks = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [paragraphs][crate::model::document::Page::paragraphs].
        pub fn set_paragraphs<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page::Paragraph>,
        {
            use std::iter::Iterator;
            self.paragraphs = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [lines][crate::model::document::Page::lines].
        pub fn set_lines<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page::Line>,
        {
            use std::iter::Iterator;
            self.lines = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [tokens][crate::model::document::Page::tokens].
        pub fn set_tokens<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page::Token>,
        {
            use std::iter::Iterator;
            self.tokens = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [visual_elements][crate::model::document::Page::visual_elements].
        pub fn set_visual_elements<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page::VisualElement>,
        {
            use std::iter::Iterator;
            self.visual_elements = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [tables][crate::model::document::Page::tables].
        pub fn set_tables<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page::Table>,
        {
            use std::iter::Iterator;
            self.tables = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [form_fields][crate::model::document::Page::form_fields].
        pub fn set_form_fields<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page::FormField>,
        {
            use std::iter::Iterator;
            self.form_fields = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [symbols][crate::model::document::Page::symbols].
        pub fn set_symbols<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page::Symbol>,
        {
            use std::iter::Iterator;
            self.symbols = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [detected_barcodes][crate::model::document::Page::detected_barcodes].
        pub fn set_detected_barcodes<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page::DetectedBarcode>,
        {
            use std::iter::Iterator;
            self.detected_barcodes = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
        pub fn set_image_quality_scores<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
        {
            self.image_quality_scores = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
        pub fn set_or_clear_image_quality_scores<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
        {
            self.image_quality_scores = v.map(|x| x.into());
            self
        }

        /// Sets the value of [provenance][crate::model::document::Page::provenance].
        #[deprecated]
        pub fn set_provenance<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::Provenance>,
        {
            self.provenance = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [provenance][crate::model::document::Page::provenance].
        #[deprecated]
        pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::Provenance>,
        {
            self.provenance = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for Page {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.Page"
        }
    }

    /// Defines additional types related to [Page].
    pub mod page {
        #[allow(unused_imports)]
        use super::*;

        /// Dimension for the page.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Dimension {
            /// Page width.
            pub width: f32,

            /// Page height.
            pub height: f32,

            /// Dimension unit.
            pub unit: std::string::String,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Dimension {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [width][crate::model::document::page::Dimension::width].
            pub fn set_width<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
                self.width = v.into();
                self
            }

            /// Sets the value of [height][crate::model::document::page::Dimension::height].
            pub fn set_height<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
                self.height = v.into();
                self
            }

            /// Sets the value of [unit][crate::model::document::page::Dimension::unit].
            pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
                self.unit = v.into();
                self
            }
        }

        impl wkt::message::Message for Dimension {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Dimension"
            }
        }

        /// Rendered image contents for this page.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Image {
            /// Raw byte content of the image.
            pub content: ::bytes::Bytes,

            /// Encoding [media type (MIME
            /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml)
            /// for the image.
            pub mime_type: std::string::String,

            /// Width of the image in pixels.
            pub width: i32,

            /// Height of the image in pixels.
            pub height: i32,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Image {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [content][crate::model::document::page::Image::content].
            pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
                self.content = v.into();
                self
            }

            /// Sets the value of [mime_type][crate::model::document::page::Image::mime_type].
            pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.mime_type = v.into();
                self
            }

            /// Sets the value of [width][crate::model::document::page::Image::width].
            pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.width = v.into();
                self
            }

            /// Sets the value of [height][crate::model::document::page::Image::height].
            pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.height = v.into();
                self
            }
        }

        impl wkt::message::Message for Image {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Image"
            }
        }

        /// Representation for transformation matrix, intended to be compatible and
        /// used with OpenCV format for image manipulation.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Matrix {
            /// Number of rows in the matrix.
            pub rows: i32,

            /// Number of columns in the matrix.
            pub cols: i32,

            /// This encodes information about what data type the matrix uses.
            /// For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list
            /// of OpenCV primitive data types, please refer to
            /// <https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html>
            pub r#type: i32,

            /// The matrix data.
            pub data: ::bytes::Bytes,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Matrix {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [rows][crate::model::document::page::Matrix::rows].
            pub fn set_rows<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.rows = v.into();
                self
            }

            /// Sets the value of [cols][crate::model::document::page::Matrix::cols].
            pub fn set_cols<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.cols = v.into();
                self
            }

            /// Sets the value of [r#type][crate::model::document::page::Matrix::type].
            pub fn set_type<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.r#type = v.into();
                self
            }

            /// Sets the value of [data][crate::model::document::page::Matrix::data].
            pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
                self.data = v.into();
                self
            }
        }

        impl wkt::message::Message for Matrix {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Matrix"
            }
        }

        /// Visual element describing a layout unit on a page.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Layout {
            /// Text anchor indexing into the
            /// [Document.text][google.cloud.documentai.v1.Document.text].
            ///
            /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
            pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,

            /// Confidence of the current
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] within
            /// context of the object this layout is for. e.g. confidence can be for a
            /// single token, a table, a visual element, etc. depending on context.
            /// Range `[0, 1]`.
            ///
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            pub confidence: f32,

            /// The bounding polygon for the
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
            ///
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,

            /// Detected orientation for the
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
            ///
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            pub orientation: crate::model::document::page::layout::Orientation,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Layout {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
            pub fn set_text_anchor<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::TextAnchor>,
            {
                self.text_anchor = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
            pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::TextAnchor>,
            {
                self.text_anchor = v.map(|x| x.into());
                self
            }

            /// Sets the value of [confidence][crate::model::document::page::Layout::confidence].
            pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
                self.confidence = v.into();
                self
            }

            /// Sets the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
            pub fn set_bounding_poly<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::BoundingPoly>,
            {
                self.bounding_poly = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
            pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::BoundingPoly>,
            {
                self.bounding_poly = v.map(|x| x.into());
                self
            }

            /// Sets the value of [orientation][crate::model::document::page::Layout::orientation].
            pub fn set_orientation<
                T: std::convert::Into<crate::model::document::page::layout::Orientation>,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.orientation = v.into();
                self
            }
        }

        impl wkt::message::Message for Layout {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Layout"
            }
        }

        /// Defines additional types related to [Layout].
        pub mod layout {
            #[allow(unused_imports)]
            use super::*;

            /// Detected human reading orientation.
            ///
            /// # Working with unknown values
            ///
            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
            /// additional enum variants at any time. Adding new variants is not considered
            /// a breaking change. Applications should write their code in anticipation of:
            ///
            /// - New values appearing in future releases of the client library, **and**
            /// - New values received dynamically, without application changes.
            ///
            /// Please consult the [Working with enums] section in the user guide for some
            /// guidelines.
            ///
            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum Orientation {
                /// Unspecified orientation.
                Unspecified,
                /// Orientation is aligned with page up.
                PageUp,
                /// Orientation is aligned with page right.
                /// Turn the head 90 degrees clockwise from upright to read.
                PageRight,
                /// Orientation is aligned with page down.
                /// Turn the head 180 degrees from upright to read.
                PageDown,
                /// Orientation is aligned with page left.
                /// Turn the head 90 degrees counterclockwise from upright to read.
                PageLeft,
                /// If set, the enum was initialized with an unknown value.
                ///
                /// Applications can examine the value using [Orientation::value] or
                /// [Orientation::name].
                UnknownValue(orientation::UnknownValue),
            }

            #[doc(hidden)]
            pub mod orientation {
                #[allow(unused_imports)]
                use super::*;
                #[derive(Clone, Debug, PartialEq)]
                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
            }

            impl Orientation {
                /// Gets the enum value.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the string representation of enums.
                pub fn value(&self) -> std::option::Option<i32> {
                    match self {
                        Self::Unspecified => std::option::Option::Some(0),
                        Self::PageUp => std::option::Option::Some(1),
                        Self::PageRight => std::option::Option::Some(2),
                        Self::PageDown => std::option::Option::Some(3),
                        Self::PageLeft => std::option::Option::Some(4),
                        Self::UnknownValue(u) => u.0.value(),
                    }
                }

                /// Gets the enum value as a string.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the integer representation of enums.
                pub fn name(&self) -> std::option::Option<&str> {
                    match self {
                        Self::Unspecified => std::option::Option::Some("ORIENTATION_UNSPECIFIED"),
                        Self::PageUp => std::option::Option::Some("PAGE_UP"),
                        Self::PageRight => std::option::Option::Some("PAGE_RIGHT"),
                        Self::PageDown => std::option::Option::Some("PAGE_DOWN"),
                        Self::PageLeft => std::option::Option::Some("PAGE_LEFT"),
                        Self::UnknownValue(u) => u.0.name(),
                    }
                }
            }

            impl std::default::Default for Orientation {
                fn default() -> Self {
                    use std::convert::From;
                    Self::from(0)
                }
            }

            impl std::fmt::Display for Orientation {
                fn fmt(
                    &self,
                    f: &mut std::fmt::Formatter<'_>,
                ) -> std::result::Result<(), std::fmt::Error> {
                    wkt::internal::display_enum(f, self.name(), self.value())
                }
            }

            impl std::convert::From<i32> for Orientation {
                fn from(value: i32) -> Self {
                    match value {
                        0 => Self::Unspecified,
                        1 => Self::PageUp,
                        2 => Self::PageRight,
                        3 => Self::PageDown,
                        4 => Self::PageLeft,
                        _ => Self::UnknownValue(orientation::UnknownValue(
                            wkt::internal::UnknownEnumValue::Integer(value),
                        )),
                    }
                }
            }

            impl std::convert::From<&str> for Orientation {
                fn from(value: &str) -> Self {
                    use std::string::ToString;
                    match value {
                        "ORIENTATION_UNSPECIFIED" => Self::Unspecified,
                        "PAGE_UP" => Self::PageUp,
                        "PAGE_RIGHT" => Self::PageRight,
                        "PAGE_DOWN" => Self::PageDown,
                        "PAGE_LEFT" => Self::PageLeft,
                        _ => Self::UnknownValue(orientation::UnknownValue(
                            wkt::internal::UnknownEnumValue::String(value.to_string()),
                        )),
                    }
                }
            }

            impl serde::ser::Serialize for Orientation {
                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
                where
                    S: serde::Serializer,
                {
                    match self {
                        Self::Unspecified => serializer.serialize_i32(0),
                        Self::PageUp => serializer.serialize_i32(1),
                        Self::PageRight => serializer.serialize_i32(2),
                        Self::PageDown => serializer.serialize_i32(3),
                        Self::PageLeft => serializer.serialize_i32(4),
                        Self::UnknownValue(u) => u.0.serialize(serializer),
                    }
                }
            }

            impl<'de> serde::de::Deserialize<'de> for Orientation {
                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
                where
                    D: serde::Deserializer<'de>,
                {
                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<Orientation>::new(
                        ".google.cloud.documentai.v1.Document.Page.Layout.Orientation",
                    ))
                }
            }
        }

        /// A block has a set of lines (collected into paragraphs) that have a
        /// common line-spacing and orientation.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Block {
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
            /// [Block][google.cloud.documentai.v1.Document.Page.Block].
            ///
            /// [google.cloud.documentai.v1.Document.Page.Block]: crate::model::document::page::Block
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            pub layout: std::option::Option<crate::model::document::page::Layout>,

            /// A list of detected languages together with confidence.
            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,

            /// The history of this annotation.
            #[deprecated]
            pub provenance: std::option::Option<crate::model::document::Provenance>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Block {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [layout][crate::model::document::page::Block::layout].
            pub fn set_layout<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [layout][crate::model::document::page::Block::layout].
            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = v.map(|x| x.into());
                self
            }

            /// Sets the value of [detected_languages][crate::model::document::page::Block::detected_languages].
            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
            {
                use std::iter::Iterator;
                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [provenance][crate::model::document::page::Block::provenance].
            #[deprecated]
            pub fn set_provenance<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [provenance][crate::model::document::page::Block::provenance].
            #[deprecated]
            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for Block {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Block"
            }
        }

        /// A collection of lines that a human would perceive as a paragraph.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Paragraph {
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
            /// [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph].
            ///
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            /// [google.cloud.documentai.v1.Document.Page.Paragraph]: crate::model::document::page::Paragraph
            pub layout: std::option::Option<crate::model::document::page::Layout>,

            /// A list of detected languages together with confidence.
            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,

            /// The  history of this annotation.
            #[deprecated]
            pub provenance: std::option::Option<crate::model::document::Provenance>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Paragraph {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [layout][crate::model::document::page::Paragraph::layout].
            pub fn set_layout<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [layout][crate::model::document::page::Paragraph::layout].
            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = v.map(|x| x.into());
                self
            }

            /// Sets the value of [detected_languages][crate::model::document::page::Paragraph::detected_languages].
            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
            {
                use std::iter::Iterator;
                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [provenance][crate::model::document::page::Paragraph::provenance].
            #[deprecated]
            pub fn set_provenance<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [provenance][crate::model::document::page::Paragraph::provenance].
            #[deprecated]
            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for Paragraph {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Paragraph"
            }
        }

        /// A collection of tokens that a human would perceive as a line.
        /// Does not cross column boundaries, can be horizontal, vertical, etc.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Line {
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
            /// [Line][google.cloud.documentai.v1.Document.Page.Line].
            ///
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            /// [google.cloud.documentai.v1.Document.Page.Line]: crate::model::document::page::Line
            pub layout: std::option::Option<crate::model::document::page::Layout>,

            /// A list of detected languages together with confidence.
            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,

            /// The  history of this annotation.
            #[deprecated]
            pub provenance: std::option::Option<crate::model::document::Provenance>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Line {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [layout][crate::model::document::page::Line::layout].
            pub fn set_layout<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [layout][crate::model::document::page::Line::layout].
            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = v.map(|x| x.into());
                self
            }

            /// Sets the value of [detected_languages][crate::model::document::page::Line::detected_languages].
            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
            {
                use std::iter::Iterator;
                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [provenance][crate::model::document::page::Line::provenance].
            #[deprecated]
            pub fn set_provenance<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [provenance][crate::model::document::page::Line::provenance].
            #[deprecated]
            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for Line {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Line"
            }
        }

        /// A detected token.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Token {
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
            /// [Token][google.cloud.documentai.v1.Document.Page.Token].
            ///
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
            pub layout: std::option::Option<crate::model::document::page::Layout>,

            /// Detected break at the end of a
            /// [Token][google.cloud.documentai.v1.Document.Page.Token].
            ///
            /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
            pub detected_break:
                std::option::Option<crate::model::document::page::token::DetectedBreak>,

            /// A list of detected languages together with confidence.
            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,

            /// The history of this annotation.
            #[deprecated]
            pub provenance: std::option::Option<crate::model::document::Provenance>,

            /// Text style attributes.
            pub style_info: std::option::Option<crate::model::document::page::token::StyleInfo>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Token {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [layout][crate::model::document::page::Token::layout].
            pub fn set_layout<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [layout][crate::model::document::page::Token::layout].
            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = v.map(|x| x.into());
                self
            }

            /// Sets the value of [detected_break][crate::model::document::page::Token::detected_break].
            pub fn set_detected_break<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
            {
                self.detected_break = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [detected_break][crate::model::document::page::Token::detected_break].
            pub fn set_or_clear_detected_break<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
            {
                self.detected_break = v.map(|x| x.into());
                self
            }

            /// Sets the value of [detected_languages][crate::model::document::page::Token::detected_languages].
            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
            {
                use std::iter::Iterator;
                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [provenance][crate::model::document::page::Token::provenance].
            #[deprecated]
            pub fn set_provenance<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [provenance][crate::model::document::page::Token::provenance].
            #[deprecated]
            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = v.map(|x| x.into());
                self
            }

            /// Sets the value of [style_info][crate::model::document::page::Token::style_info].
            pub fn set_style_info<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
            {
                self.style_info = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [style_info][crate::model::document::page::Token::style_info].
            pub fn set_or_clear_style_info<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
            {
                self.style_info = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for Token {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token"
            }
        }

        /// Defines additional types related to [Token].
        pub mod token {
            #[allow(unused_imports)]
            use super::*;

            /// Detected break at the end of a
            /// [Token][google.cloud.documentai.v1.Document.Page.Token].
            ///
            /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct DetectedBreak {
                /// Detected break type.
                pub r#type: crate::model::document::page::token::detected_break::Type,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl DetectedBreak {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [r#type][crate::model::document::page::token::DetectedBreak::type].
                pub fn set_type<
                    T: std::convert::Into<crate::model::document::page::token::detected_break::Type>,
                >(
                    mut self,
                    v: T,
                ) -> Self {
                    self.r#type = v.into();
                    self
                }
            }

            impl wkt::message::Message for DetectedBreak {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.DetectedBreak"
                }
            }

            /// Defines additional types related to [DetectedBreak].
            pub mod detected_break {
                #[allow(unused_imports)]
                use super::*;

                /// Enum to denote the type of break found.
                ///
                /// # Working with unknown values
                ///
                /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
                /// additional enum variants at any time. Adding new variants is not considered
                /// a breaking change. Applications should write their code in anticipation of:
                ///
                /// - New values appearing in future releases of the client library, **and**
                /// - New values received dynamically, without application changes.
                ///
                /// Please consult the [Working with enums] section in the user guide for some
                /// guidelines.
                ///
                /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
                #[derive(Clone, Debug, PartialEq)]
                #[non_exhaustive]
                pub enum Type {
                    /// Unspecified break type.
                    Unspecified,
                    /// A single whitespace.
                    Space,
                    /// A wider whitespace.
                    WideSpace,
                    /// A hyphen that indicates that a token has been split across lines.
                    Hyphen,
                    /// If set, the enum was initialized with an unknown value.
                    ///
                    /// Applications can examine the value using [Type::value] or
                    /// [Type::name].
                    UnknownValue(r#type::UnknownValue),
                }

                #[doc(hidden)]
                pub mod r#type {
                    #[allow(unused_imports)]
                    use super::*;
                    #[derive(Clone, Debug, PartialEq)]
                    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
                }

                impl Type {
                    /// Gets the enum value.
                    ///
                    /// Returns `None` if the enum contains an unknown value deserialized from
                    /// the string representation of enums.
                    pub fn value(&self) -> std::option::Option<i32> {
                        match self {
                            Self::Unspecified => std::option::Option::Some(0),
                            Self::Space => std::option::Option::Some(1),
                            Self::WideSpace => std::option::Option::Some(2),
                            Self::Hyphen => std::option::Option::Some(3),
                            Self::UnknownValue(u) => u.0.value(),
                        }
                    }

                    /// Gets the enum value as a string.
                    ///
                    /// Returns `None` if the enum contains an unknown value deserialized from
                    /// the integer representation of enums.
                    pub fn name(&self) -> std::option::Option<&str> {
                        match self {
                            Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
                            Self::Space => std::option::Option::Some("SPACE"),
                            Self::WideSpace => std::option::Option::Some("WIDE_SPACE"),
                            Self::Hyphen => std::option::Option::Some("HYPHEN"),
                            Self::UnknownValue(u) => u.0.name(),
                        }
                    }
                }

                impl std::default::Default for Type {
                    fn default() -> Self {
                        use std::convert::From;
                        Self::from(0)
                    }
                }

                impl std::fmt::Display for Type {
                    fn fmt(
                        &self,
                        f: &mut std::fmt::Formatter<'_>,
                    ) -> std::result::Result<(), std::fmt::Error> {
                        wkt::internal::display_enum(f, self.name(), self.value())
                    }
                }

                impl std::convert::From<i32> for Type {
                    fn from(value: i32) -> Self {
                        match value {
                            0 => Self::Unspecified,
                            1 => Self::Space,
                            2 => Self::WideSpace,
                            3 => Self::Hyphen,
                            _ => Self::UnknownValue(r#type::UnknownValue(
                                wkt::internal::UnknownEnumValue::Integer(value),
                            )),
                        }
                    }
                }

                impl std::convert::From<&str> for Type {
                    fn from(value: &str) -> Self {
                        use std::string::ToString;
                        match value {
                            "TYPE_UNSPECIFIED" => Self::Unspecified,
                            "SPACE" => Self::Space,
                            "WIDE_SPACE" => Self::WideSpace,
                            "HYPHEN" => Self::Hyphen,
                            _ => Self::UnknownValue(r#type::UnknownValue(
                                wkt::internal::UnknownEnumValue::String(value.to_string()),
                            )),
                        }
                    }
                }

                impl serde::ser::Serialize for Type {
                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
                    where
                        S: serde::Serializer,
                    {
                        match self {
                            Self::Unspecified => serializer.serialize_i32(0),
                            Self::Space => serializer.serialize_i32(1),
                            Self::WideSpace => serializer.serialize_i32(2),
                            Self::Hyphen => serializer.serialize_i32(3),
                            Self::UnknownValue(u) => u.0.serialize(serializer),
                        }
                    }
                }

                impl<'de> serde::de::Deserialize<'de> for Type {
                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
                    where
                        D: serde::Deserializer<'de>,
                    {
                        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
                            ".google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type",
                        ))
                    }
                }
            }

            /// Font and other text style attributes.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct StyleInfo {
                /// Font size in points (`1` point is `¹⁄₇₂` inches).
                pub font_size: i32,

                /// Font size in pixels, equal to _unrounded
                /// [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_
                ///
                /// * _resolution_ ÷ `72.0`.
                ///
                /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]: crate::model::document::page::token::StyleInfo::font_size
                pub pixel_font_size: f64,

                /// Letter spacing in points.
                pub letter_spacing: f64,

                /// Name or style of the font.
                pub font_type: std::string::String,

                /// Whether the text is bold (equivalent to
                /// [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]
                /// is at least `700`).
                ///
                /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]: crate::model::document::page::token::StyleInfo::font_weight
                pub bold: bool,

                /// Whether the text is italic.
                pub italic: bool,

                /// Whether the text is underlined.
                pub underlined: bool,

                /// Whether the text is strikethrough. This feature is not supported yet.
                pub strikeout: bool,

                /// Whether the text is a subscript. This feature is not supported yet.
                pub subscript: bool,

                /// Whether the text is a superscript. This feature is not supported yet.
                pub superscript: bool,

                /// Whether the text is in small caps. This feature is not supported yet.
                pub smallcaps: bool,

                /// TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy).
                /// Normal is `400`, bold is `700`.
                pub font_weight: i32,

                /// Whether the text is handwritten.
                pub handwritten: bool,

                /// Color of the text.
                pub text_color: std::option::Option<gtype::model::Color>,

                /// Color of the background.
                pub background_color: std::option::Option<gtype::model::Color>,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl StyleInfo {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [font_size][crate::model::document::page::token::StyleInfo::font_size].
                pub fn set_font_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                    self.font_size = v.into();
                    self
                }

                /// Sets the value of [pixel_font_size][crate::model::document::page::token::StyleInfo::pixel_font_size].
                pub fn set_pixel_font_size<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
                    self.pixel_font_size = v.into();
                    self
                }

                /// Sets the value of [letter_spacing][crate::model::document::page::token::StyleInfo::letter_spacing].
                pub fn set_letter_spacing<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
                    self.letter_spacing = v.into();
                    self
                }

                /// Sets the value of [font_type][crate::model::document::page::token::StyleInfo::font_type].
                pub fn set_font_type<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.font_type = v.into();
                    self
                }

                /// Sets the value of [bold][crate::model::document::page::token::StyleInfo::bold].
                pub fn set_bold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                    self.bold = v.into();
                    self
                }

                /// Sets the value of [italic][crate::model::document::page::token::StyleInfo::italic].
                pub fn set_italic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                    self.italic = v.into();
                    self
                }

                /// Sets the value of [underlined][crate::model::document::page::token::StyleInfo::underlined].
                pub fn set_underlined<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                    self.underlined = v.into();
                    self
                }

                /// Sets the value of [strikeout][crate::model::document::page::token::StyleInfo::strikeout].
                pub fn set_strikeout<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                    self.strikeout = v.into();
                    self
                }

                /// Sets the value of [subscript][crate::model::document::page::token::StyleInfo::subscript].
                pub fn set_subscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                    self.subscript = v.into();
                    self
                }

                /// Sets the value of [superscript][crate::model::document::page::token::StyleInfo::superscript].
                pub fn set_superscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                    self.superscript = v.into();
                    self
                }

                /// Sets the value of [smallcaps][crate::model::document::page::token::StyleInfo::smallcaps].
                pub fn set_smallcaps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                    self.smallcaps = v.into();
                    self
                }

                /// Sets the value of [font_weight][crate::model::document::page::token::StyleInfo::font_weight].
                pub fn set_font_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                    self.font_weight = v.into();
                    self
                }

                /// Sets the value of [handwritten][crate::model::document::page::token::StyleInfo::handwritten].
                pub fn set_handwritten<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                    self.handwritten = v.into();
                    self
                }

                /// Sets the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
                pub fn set_text_color<T>(mut self, v: T) -> Self
                where
                    T: std::convert::Into<gtype::model::Color>,
                {
                    self.text_color = std::option::Option::Some(v.into());
                    self
                }

                /// Sets or clears the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
                pub fn set_or_clear_text_color<T>(mut self, v: std::option::Option<T>) -> Self
                where
                    T: std::convert::Into<gtype::model::Color>,
                {
                    self.text_color = v.map(|x| x.into());
                    self
                }

                /// Sets the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
                pub fn set_background_color<T>(mut self, v: T) -> Self
                where
                    T: std::convert::Into<gtype::model::Color>,
                {
                    self.background_color = std::option::Option::Some(v.into());
                    self
                }

                /// Sets or clears the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
                pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
                where
                    T: std::convert::Into<gtype::model::Color>,
                {
                    self.background_color = v.map(|x| x.into());
                    self
                }
            }

            impl wkt::message::Message for StyleInfo {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.StyleInfo"
                }
            }
        }

        /// A detected symbol.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Symbol {
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
            /// [Symbol][google.cloud.documentai.v1.Document.Page.Symbol].
            ///
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            /// [google.cloud.documentai.v1.Document.Page.Symbol]: crate::model::document::page::Symbol
            pub layout: std::option::Option<crate::model::document::page::Layout>,

            /// A list of detected languages together with confidence.
            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Symbol {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [layout][crate::model::document::page::Symbol::layout].
            pub fn set_layout<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [layout][crate::model::document::page::Symbol::layout].
            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = v.map(|x| x.into());
                self
            }

            /// Sets the value of [detected_languages][crate::model::document::page::Symbol::detected_languages].
            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
            {
                use std::iter::Iterator;
                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
                self
            }
        }

        impl wkt::message::Message for Symbol {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Symbol"
            }
        }

        /// Detected non-text visual elements e.g. checkbox, signature etc. on the
        /// page.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct VisualElement {
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
            /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
            ///
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
            pub layout: std::option::Option<crate::model::document::page::Layout>,

            /// Type of the
            /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
            ///
            /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
            pub r#type: std::string::String,

            /// A list of detected languages together with confidence.
            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl VisualElement {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [layout][crate::model::document::page::VisualElement::layout].
            pub fn set_layout<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [layout][crate::model::document::page::VisualElement::layout].
            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = v.map(|x| x.into());
                self
            }

            /// Sets the value of [r#type][crate::model::document::page::VisualElement::type].
            pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
                self.r#type = v.into();
                self
            }

            /// Sets the value of [detected_languages][crate::model::document::page::VisualElement::detected_languages].
            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
            {
                use std::iter::Iterator;
                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
                self
            }
        }

        impl wkt::message::Message for VisualElement {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.VisualElement"
            }
        }

        /// A table representation similar to HTML table structure.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Table {
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
            /// [Table][google.cloud.documentai.v1.Document.Page.Table].
            ///
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            /// [google.cloud.documentai.v1.Document.Page.Table]: crate::model::document::page::Table
            pub layout: std::option::Option<crate::model::document::page::Layout>,

            /// Header rows of the table.
            pub header_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,

            /// Body rows of the table.
            pub body_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,

            /// A list of detected languages together with confidence.
            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,

            /// The history of this table.
            #[deprecated]
            pub provenance: std::option::Option<crate::model::document::Provenance>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Table {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [layout][crate::model::document::page::Table::layout].
            pub fn set_layout<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [layout][crate::model::document::page::Table::layout].
            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = v.map(|x| x.into());
                self
            }

            /// Sets the value of [header_rows][crate::model::document::page::Table::header_rows].
            pub fn set_header_rows<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<crate::model::document::page::table::TableRow>,
            {
                use std::iter::Iterator;
                self.header_rows = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [body_rows][crate::model::document::page::Table::body_rows].
            pub fn set_body_rows<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<crate::model::document::page::table::TableRow>,
            {
                use std::iter::Iterator;
                self.body_rows = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [detected_languages][crate::model::document::page::Table::detected_languages].
            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
            {
                use std::iter::Iterator;
                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [provenance][crate::model::document::page::Table::provenance].
            #[deprecated]
            pub fn set_provenance<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [provenance][crate::model::document::page::Table::provenance].
            #[deprecated]
            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for Table {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table"
            }
        }

        /// Defines additional types related to [Table].
        pub mod table {
            #[allow(unused_imports)]
            use super::*;

            /// A row of table cells.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct TableRow {
                /// Cells that make up this row.
                pub cells: std::vec::Vec<crate::model::document::page::table::TableCell>,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl TableRow {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [cells][crate::model::document::page::table::TableRow::cells].
                pub fn set_cells<T, V>(mut self, v: T) -> Self
                where
                    T: std::iter::IntoIterator<Item = V>,
                    V: std::convert::Into<crate::model::document::page::table::TableCell>,
                {
                    use std::iter::Iterator;
                    self.cells = v.into_iter().map(|i| i.into()).collect();
                    self
                }
            }

            impl wkt::message::Message for TableRow {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableRow"
                }
            }

            /// A cell representation inside the table.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct TableCell {
                /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
                /// [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell].
                ///
                /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
                /// [google.cloud.documentai.v1.Document.Page.Table.TableCell]: crate::model::document::page::table::TableCell
                pub layout: std::option::Option<crate::model::document::page::Layout>,

                /// How many rows this cell spans.
                pub row_span: i32,

                /// How many columns this cell spans.
                pub col_span: i32,

                /// A list of detected languages together with confidence.
                pub detected_languages:
                    std::vec::Vec<crate::model::document::page::DetectedLanguage>,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl TableCell {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [layout][crate::model::document::page::table::TableCell::layout].
                pub fn set_layout<T>(mut self, v: T) -> Self
                where
                    T: std::convert::Into<crate::model::document::page::Layout>,
                {
                    self.layout = std::option::Option::Some(v.into());
                    self
                }

                /// Sets or clears the value of [layout][crate::model::document::page::table::TableCell::layout].
                pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
                where
                    T: std::convert::Into<crate::model::document::page::Layout>,
                {
                    self.layout = v.map(|x| x.into());
                    self
                }

                /// Sets the value of [row_span][crate::model::document::page::table::TableCell::row_span].
                pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                    self.row_span = v.into();
                    self
                }

                /// Sets the value of [col_span][crate::model::document::page::table::TableCell::col_span].
                pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                    self.col_span = v.into();
                    self
                }

                /// Sets the value of [detected_languages][crate::model::document::page::table::TableCell::detected_languages].
                pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
                where
                    T: std::iter::IntoIterator<Item = V>,
                    V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
                {
                    use std::iter::Iterator;
                    self.detected_languages = v.into_iter().map(|i| i.into()).collect();
                    self
                }
            }

            impl wkt::message::Message for TableCell {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableCell"
                }
            }
        }

        /// A form field detected on the page.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct FormField {
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
            /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] name.
            /// e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc.
            ///
            /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            pub field_name: std::option::Option<crate::model::document::page::Layout>,

            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
            /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] value.
            ///
            /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            pub field_value: std::option::Option<crate::model::document::page::Layout>,

            /// A list of detected languages for name together with confidence.
            pub name_detected_languages:
                std::vec::Vec<crate::model::document::page::DetectedLanguage>,

            /// A list of detected languages for value together with confidence.
            pub value_detected_languages:
                std::vec::Vec<crate::model::document::page::DetectedLanguage>,

            /// If the value is non-textual, this field represents the type. Current
            /// valid values are:
            ///
            /// - blank (this indicates the `field_value` is normal text)
            /// - `unfilled_checkbox`
            /// - `filled_checkbox`
            pub value_type: std::string::String,

            /// Created for Labeling UI to export key text.
            /// If corrections were made to the text identified by the
            /// `field_name.text_anchor`, this field will contain the correction.
            pub corrected_key_text: std::string::String,

            /// Created for Labeling UI to export value text.
            /// If corrections were made to the text identified by the
            /// `field_value.text_anchor`, this field will contain the correction.
            pub corrected_value_text: std::string::String,

            /// The history of this annotation.
            pub provenance: std::option::Option<crate::model::document::Provenance>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl FormField {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [field_name][crate::model::document::page::FormField::field_name].
            pub fn set_field_name<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.field_name = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [field_name][crate::model::document::page::FormField::field_name].
            pub fn set_or_clear_field_name<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.field_name = v.map(|x| x.into());
                self
            }

            /// Sets the value of [field_value][crate::model::document::page::FormField::field_value].
            pub fn set_field_value<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.field_value = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [field_value][crate::model::document::page::FormField::field_value].
            pub fn set_or_clear_field_value<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.field_value = v.map(|x| x.into());
                self
            }

            /// Sets the value of [name_detected_languages][crate::model::document::page::FormField::name_detected_languages].
            pub fn set_name_detected_languages<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
            {
                use std::iter::Iterator;
                self.name_detected_languages = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [value_detected_languages][crate::model::document::page::FormField::value_detected_languages].
            pub fn set_value_detected_languages<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
            {
                use std::iter::Iterator;
                self.value_detected_languages = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [value_type][crate::model::document::page::FormField::value_type].
            pub fn set_value_type<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.value_type = v.into();
                self
            }

            /// Sets the value of [corrected_key_text][crate::model::document::page::FormField::corrected_key_text].
            pub fn set_corrected_key_text<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.corrected_key_text = v.into();
                self
            }

            /// Sets the value of [corrected_value_text][crate::model::document::page::FormField::corrected_value_text].
            pub fn set_corrected_value_text<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.corrected_value_text = v.into();
                self
            }

            /// Sets the value of [provenance][crate::model::document::page::FormField::provenance].
            pub fn set_provenance<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [provenance][crate::model::document::page::FormField::provenance].
            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::Provenance>,
            {
                self.provenance = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for FormField {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.FormField"
            }
        }

        /// A detected barcode.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct DetectedBarcode {
            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
            /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
            ///
            /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
            pub layout: std::option::Option<crate::model::document::page::Layout>,

            /// Detailed barcode information of the
            /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
            ///
            /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
            pub barcode: std::option::Option<crate::model::Barcode>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl DetectedBarcode {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [layout][crate::model::document::page::DetectedBarcode::layout].
            pub fn set_layout<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [layout][crate::model::document::page::DetectedBarcode::layout].
            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::document::page::Layout>,
            {
                self.layout = v.map(|x| x.into());
                self
            }

            /// Sets the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
            pub fn set_barcode<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::Barcode>,
            {
                self.barcode = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
            pub fn set_or_clear_barcode<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::Barcode>,
            {
                self.barcode = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for DetectedBarcode {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedBarcode"
            }
        }

        /// Detected language for a structural component.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct DetectedLanguage {
            /// The [BCP-47 language
            /// code](https://www.unicode.org/reports/tr35/#Unicode_locale_identifier),
            /// such as `en-US` or `sr-Latn`.
            pub language_code: std::string::String,

            /// Confidence of detected language. Range `[0, 1]`.
            pub confidence: f32,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl DetectedLanguage {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [language_code][crate::model::document::page::DetectedLanguage::language_code].
            pub fn set_language_code<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.language_code = v.into();
                self
            }

            /// Sets the value of [confidence][crate::model::document::page::DetectedLanguage::confidence].
            pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
                self.confidence = v.into();
                self
            }
        }

        impl wkt::message::Message for DetectedLanguage {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedLanguage"
            }
        }

        /// Image quality scores for the page image.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct ImageQualityScores {
            /// The overall quality score. Range `[0, 1]` where `1` is perfect quality.
            pub quality_score: f32,

            /// A list of detected defects.
            pub detected_defects:
                std::vec::Vec<crate::model::document::page::image_quality_scores::DetectedDefect>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl ImageQualityScores {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [quality_score][crate::model::document::page::ImageQualityScores::quality_score].
            pub fn set_quality_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
                self.quality_score = v.into();
                self
            }

            /// Sets the value of [detected_defects][crate::model::document::page::ImageQualityScores::detected_defects].
            pub fn set_detected_defects<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<
                        crate::model::document::page::image_quality_scores::DetectedDefect,
                    >,
            {
                use std::iter::Iterator;
                self.detected_defects = v.into_iter().map(|i| i.into()).collect();
                self
            }
        }

        impl wkt::message::Message for ImageQualityScores {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores"
            }
        }

        /// Defines additional types related to [ImageQualityScores].
        pub mod image_quality_scores {
            #[allow(unused_imports)]
            use super::*;

            /// Image Quality Defects
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct DetectedDefect {
                /// Name of the defect type. Supported values are:
                ///
                /// - `quality/defect_blurry`
                /// - `quality/defect_noisy`
                /// - `quality/defect_dark`
                /// - `quality/defect_faint`
                /// - `quality/defect_text_too_small`
                /// - `quality/defect_document_cutoff`
                /// - `quality/defect_text_cutoff`
                /// - `quality/defect_glare`
                pub r#type: std::string::String,

                /// Confidence of detected defect. Range `[0, 1]` where `1` indicates
                /// strong confidence that the defect exists.
                pub confidence: f32,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl DetectedDefect {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [r#type][crate::model::document::page::image_quality_scores::DetectedDefect::type].
                pub fn set_type<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.r#type = v.into();
                    self
                }

                /// Sets the value of [confidence][crate::model::document::page::image_quality_scores::DetectedDefect::confidence].
                pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
                    self.confidence = v.into();
                    self
                }
            }

            impl wkt::message::Message for DetectedDefect {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect"
                }
            }
        }
    }

    /// An entity that could be a phrase in the text or a property that belongs to
    /// the document. It is a known entity type, such as a person, an organization,
    /// or location.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Entity {
        /// Optional. Provenance of the entity.
        /// Text anchor indexing into the
        /// [Document.text][google.cloud.documentai.v1.Document.text].
        ///
        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
        pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,

        /// Required. Entity type from a schema e.g. `Address`.
        pub r#type: std::string::String,

        /// Optional. Text value of the entity e.g. `1600 Amphitheatre Pkwy`.
        pub mention_text: std::string::String,

        /// Optional. Deprecated.  Use `id` field instead.
        pub mention_id: std::string::String,

        /// Optional. Confidence of detected Schema entity. Range `[0, 1]`.
        pub confidence: f32,

        /// Optional. Represents the provenance of this entity wrt. the location on
        /// the page where it was found.
        pub page_anchor: std::option::Option<crate::model::document::PageAnchor>,

        /// Optional. Canonical id. This will be a unique value in the entity list
        /// for this document.
        pub id: std::string::String,

        /// Optional. Normalized entity value. Absent if the extracted value could
        /// not be converted or the type (e.g. address) is not supported for certain
        /// parsers. This field is also only populated for certain supported document
        /// types.
        pub normalized_value: std::option::Option<crate::model::document::entity::NormalizedValue>,

        /// Optional. Entities can be nested to form a hierarchical data structure
        /// representing the content in the document.
        pub properties: std::vec::Vec<crate::model::document::Entity>,

        /// Optional. The history of this annotation.
        pub provenance: std::option::Option<crate::model::document::Provenance>,

        /// Optional. Whether the entity will be redacted for de-identification
        /// purposes.
        pub redacted: bool,

        /// Optional. Specifies how the entity's value is obtained.
        pub method: crate::model::document::entity::Method,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Entity {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [text_anchor][crate::model::document::Entity::text_anchor].
        pub fn set_text_anchor<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::TextAnchor>,
        {
            self.text_anchor = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [text_anchor][crate::model::document::Entity::text_anchor].
        pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::TextAnchor>,
        {
            self.text_anchor = v.map(|x| x.into());
            self
        }

        /// Sets the value of [r#type][crate::model::document::Entity::type].
        pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.r#type = v.into();
            self
        }

        /// Sets the value of [mention_text][crate::model::document::Entity::mention_text].
        pub fn set_mention_text<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.mention_text = v.into();
            self
        }

        /// Sets the value of [mention_id][crate::model::document::Entity::mention_id].
        pub fn set_mention_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.mention_id = v.into();
            self
        }

        /// Sets the value of [confidence][crate::model::document::Entity::confidence].
        pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
            self.confidence = v.into();
            self
        }

        /// Sets the value of [page_anchor][crate::model::document::Entity::page_anchor].
        pub fn set_page_anchor<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::PageAnchor>,
        {
            self.page_anchor = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [page_anchor][crate::model::document::Entity::page_anchor].
        pub fn set_or_clear_page_anchor<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::PageAnchor>,
        {
            self.page_anchor = v.map(|x| x.into());
            self
        }

        /// Sets the value of [id][crate::model::document::Entity::id].
        pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.id = v.into();
            self
        }

        /// Sets the value of [normalized_value][crate::model::document::Entity::normalized_value].
        pub fn set_normalized_value<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
        {
            self.normalized_value = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [normalized_value][crate::model::document::Entity::normalized_value].
        pub fn set_or_clear_normalized_value<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
        {
            self.normalized_value = v.map(|x| x.into());
            self
        }

        /// Sets the value of [properties][crate::model::document::Entity::properties].
        pub fn set_properties<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::Entity>,
        {
            use std::iter::Iterator;
            self.properties = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [provenance][crate::model::document::Entity::provenance].
        pub fn set_provenance<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::Provenance>,
        {
            self.provenance = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [provenance][crate::model::document::Entity::provenance].
        pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::Provenance>,
        {
            self.provenance = v.map(|x| x.into());
            self
        }

        /// Sets the value of [redacted][crate::model::document::Entity::redacted].
        pub fn set_redacted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.redacted = v.into();
            self
        }

        /// Sets the value of [method][crate::model::document::Entity::method].
        pub fn set_method<T: std::convert::Into<crate::model::document::entity::Method>>(
            mut self,
            v: T,
        ) -> Self {
            self.method = v.into();
            self
        }
    }

    impl wkt::message::Message for Entity {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.Entity"
        }
    }

    /// Defines additional types related to [Entity].
    pub mod entity {
        #[allow(unused_imports)]
        use super::*;

        /// Parsed and normalized entity value.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct NormalizedValue {
            /// Optional. An optional field to store a normalized string.
            /// For some entity types, one of respective `structured_value` fields may
            /// also be populated. Also not all the types of `structured_value` will be
            /// normalized. For example, some processors may not generate `float`
            /// or `integer` normalized text by default.
            ///
            /// Below are sample formats mapped to structured values.
            ///
            /// - Money/Currency type (`money_value`) is in the ISO 4217 text format.
            /// - Date type (`date_value`) is in the ISO 8601 text format.
            /// - Datetime type (`datetime_value`) is in the ISO 8601 text format.
            pub text: std::string::String,

            /// An optional structured entity value.
            /// Must match entity type defined in schema if
            /// known. If this field is present, the `text` field could also be
            /// populated.
            pub structured_value: std::option::Option<
                crate::model::document::entity::normalized_value::StructuredValue,
            >,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl NormalizedValue {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [text][crate::model::document::entity::NormalizedValue::text].
            pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
                self.text = v.into();
                self
            }

            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value].
            ///
            /// Note that all the setters affecting `structured_value` are mutually
            /// exclusive.
            pub fn set_structured_value<
                T: std::convert::Into<
                        std::option::Option<
                            crate::model::document::entity::normalized_value::StructuredValue,
                        >,
                    >,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.structured_value = v.into();
                self
            }

            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// if it holds a `MoneyValue`, `None` if the field is not set or
            /// holds a different branch.
            pub fn money_value(
                &self,
            ) -> std::option::Option<&std::boxed::Box<gtype::model::Money>> {
                #[allow(unreachable_patterns)]
                self.structured_value.as_ref().and_then(|v| match v {
                    crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// to hold a `MoneyValue`.
            ///
            /// Note that all the setters affecting `structured_value` are
            /// mutually exclusive.
            pub fn set_money_value<T: std::convert::Into<std::boxed::Box<gtype::model::Money>>>(
                mut self,
                v: T,
            ) -> Self {
                self.structured_value = std::option::Option::Some(
                    crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(
                        v.into(),
                    ),
                );
                self
            }

            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// if it holds a `DateValue`, `None` if the field is not set or
            /// holds a different branch.
            pub fn date_value(&self) -> std::option::Option<&std::boxed::Box<gtype::model::Date>> {
                #[allow(unreachable_patterns)]
                self.structured_value.as_ref().and_then(|v| match v {
                    crate::model::document::entity::normalized_value::StructuredValue::DateValue(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// to hold a `DateValue`.
            ///
            /// Note that all the setters affecting `structured_value` are
            /// mutually exclusive.
            pub fn set_date_value<T: std::convert::Into<std::boxed::Box<gtype::model::Date>>>(
                mut self,
                v: T,
            ) -> Self {
                self.structured_value = std::option::Option::Some(
                    crate::model::document::entity::normalized_value::StructuredValue::DateValue(
                        v.into(),
                    ),
                );
                self
            }

            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// if it holds a `DatetimeValue`, `None` if the field is not set or
            /// holds a different branch.
            pub fn datetime_value(
                &self,
            ) -> std::option::Option<&std::boxed::Box<gtype::model::DateTime>> {
                #[allow(unreachable_patterns)]
                self.structured_value.as_ref().and_then(|v| match v {
                    crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// to hold a `DatetimeValue`.
            ///
            /// Note that all the setters affecting `structured_value` are
            /// mutually exclusive.
            pub fn set_datetime_value<
                T: std::convert::Into<std::boxed::Box<gtype::model::DateTime>>,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.structured_value = std::option::Option::Some(
                    crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(
                        v.into()
                    )
                );
                self
            }

            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// if it holds a `AddressValue`, `None` if the field is not set or
            /// holds a different branch.
            pub fn address_value(
                &self,
            ) -> std::option::Option<&std::boxed::Box<gtype::model::PostalAddress>> {
                #[allow(unreachable_patterns)]
                self.structured_value.as_ref().and_then(|v| match v {
                    crate::model::document::entity::normalized_value::StructuredValue::AddressValue(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// to hold a `AddressValue`.
            ///
            /// Note that all the setters affecting `structured_value` are
            /// mutually exclusive.
            pub fn set_address_value<
                T: std::convert::Into<std::boxed::Box<gtype::model::PostalAddress>>,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.structured_value = std::option::Option::Some(
                    crate::model::document::entity::normalized_value::StructuredValue::AddressValue(
                        v.into(),
                    ),
                );
                self
            }

            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// if it holds a `BooleanValue`, `None` if the field is not set or
            /// holds a different branch.
            pub fn boolean_value(&self) -> std::option::Option<&bool> {
                #[allow(unreachable_patterns)]
                self.structured_value.as_ref().and_then(|v| match v {
                    crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// to hold a `BooleanValue`.
            ///
            /// Note that all the setters affecting `structured_value` are
            /// mutually exclusive.
            pub fn set_boolean_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                self.structured_value = std::option::Option::Some(
                    crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(
                        v.into(),
                    ),
                );
                self
            }

            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// if it holds a `IntegerValue`, `None` if the field is not set or
            /// holds a different branch.
            pub fn integer_value(&self) -> std::option::Option<&i32> {
                #[allow(unreachable_patterns)]
                self.structured_value.as_ref().and_then(|v| match v {
                    crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// to hold a `IntegerValue`.
            ///
            /// Note that all the setters affecting `structured_value` are
            /// mutually exclusive.
            pub fn set_integer_value<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.structured_value = std::option::Option::Some(
                    crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(
                        v.into(),
                    ),
                );
                self
            }

            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// if it holds a `FloatValue`, `None` if the field is not set or
            /// holds a different branch.
            pub fn float_value(&self) -> std::option::Option<&f32> {
                #[allow(unreachable_patterns)]
                self.structured_value.as_ref().and_then(|v| match v {
                    crate::model::document::entity::normalized_value::StructuredValue::FloatValue(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// to hold a `FloatValue`.
            ///
            /// Note that all the setters affecting `structured_value` are
            /// mutually exclusive.
            pub fn set_float_value<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
                self.structured_value = std::option::Option::Some(
                    crate::model::document::entity::normalized_value::StructuredValue::FloatValue(
                        v.into(),
                    ),
                );
                self
            }

            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// if it holds a `SignatureValue`, `None` if the field is not set or
            /// holds a different branch.
            pub fn signature_value(&self) -> std::option::Option<&bool> {
                #[allow(unreachable_patterns)]
                self.structured_value.as_ref().and_then(|v| match v {
                    crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
            /// to hold a `SignatureValue`.
            ///
            /// Note that all the setters affecting `structured_value` are
            /// mutually exclusive.
            pub fn set_signature_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                self.structured_value = std::option::Option::Some(
                    crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(
                        v.into()
                    )
                );
                self
            }
        }

        impl wkt::message::Message for NormalizedValue {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Entity.NormalizedValue"
            }
        }

        /// Defines additional types related to [NormalizedValue].
        pub mod normalized_value {
            #[allow(unused_imports)]
            use super::*;

            /// An optional structured entity value.
            /// Must match entity type defined in schema if
            /// known. If this field is present, the `text` field could also be
            /// populated.
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum StructuredValue {
                /// Money value. See also:
                /// <https://github.com/googleapis/googleapis/blob/master/google/type/money.proto>
                MoneyValue(std::boxed::Box<gtype::model::Money>),
                /// Date value. Includes year, month, day. See also:
                /// <https://github.com/googleapis/googleapis/blob/master/google/type/date.proto>
                DateValue(std::boxed::Box<gtype::model::Date>),
                /// DateTime value. Includes date, time, and timezone. See also:
                /// <https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto>
                DatetimeValue(std::boxed::Box<gtype::model::DateTime>),
                /// Postal address. See also:
                /// <https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto>
                AddressValue(std::boxed::Box<gtype::model::PostalAddress>),
                /// Boolean value. Can be used for entities with binary values, or for
                /// checkboxes.
                BooleanValue(bool),
                /// Integer value.
                IntegerValue(i32),
                /// Float value.
                FloatValue(f32),
                SignatureValue(bool),
            }
        }

        /// Specifies how the entity's value is obtained.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Method {
            /// When the method is not specified, it should be treated as `EXTRACT`.
            Unspecified,
            /// The entity's value is directly extracted as-is from the document
            /// text.
            Extract,
            /// The entity's value is derived through inference and is not
            /// necessarily an exact text extraction from the document.
            Derive,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [Method::value] or
            /// [Method::name].
            UnknownValue(method::UnknownValue),
        }

        #[doc(hidden)]
        pub mod method {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl Method {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::Extract => std::option::Option::Some(1),
                    Self::Derive => std::option::Option::Some(2),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
                    Self::Extract => std::option::Option::Some("EXTRACT"),
                    Self::Derive => std::option::Option::Some("DERIVE"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for Method {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for Method {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for Method {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::Extract,
                    2 => Self::Derive,
                    _ => Self::UnknownValue(method::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for Method {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "METHOD_UNSPECIFIED" => Self::Unspecified,
                    "EXTRACT" => Self::Extract,
                    "DERIVE" => Self::Derive,
                    _ => Self::UnknownValue(method::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for Method {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::Extract => serializer.serialize_i32(1),
                    Self::Derive => serializer.serialize_i32(2),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for Method {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
                    ".google.cloud.documentai.v1.Document.Entity.Method",
                ))
            }
        }
    }

    /// Relationship between
    /// [Entities][google.cloud.documentai.v1.Document.Entity].
    ///
    /// [google.cloud.documentai.v1.Document.Entity]: crate::model::document::Entity
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct EntityRelation {
        /// Subject entity id.
        pub subject_id: std::string::String,

        /// Object entity id.
        pub object_id: std::string::String,

        /// Relationship description.
        pub relation: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl EntityRelation {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [subject_id][crate::model::document::EntityRelation::subject_id].
        pub fn set_subject_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.subject_id = v.into();
            self
        }

        /// Sets the value of [object_id][crate::model::document::EntityRelation::object_id].
        pub fn set_object_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.object_id = v.into();
            self
        }

        /// Sets the value of [relation][crate::model::document::EntityRelation::relation].
        pub fn set_relation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.relation = v.into();
            self
        }
    }

    impl wkt::message::Message for EntityRelation {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.EntityRelation"
        }
    }

    /// Text reference indexing into the
    /// [Document.text][google.cloud.documentai.v1.Document.text].
    ///
    /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct TextAnchor {
        /// The text segments from the
        /// [Document.text][google.cloud.documentai.v1.Document.text].
        ///
        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
        pub text_segments: std::vec::Vec<crate::model::document::text_anchor::TextSegment>,

        /// Contains the content of the text span so that users do
        /// not have to look it up in the text_segments.  It is always
        /// populated for formFields.
        pub content: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl TextAnchor {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [text_segments][crate::model::document::TextAnchor::text_segments].
        pub fn set_text_segments<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::text_anchor::TextSegment>,
        {
            use std::iter::Iterator;
            self.text_segments = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [content][crate::model::document::TextAnchor::content].
        pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.content = v.into();
            self
        }
    }

    impl wkt::message::Message for TextAnchor {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor"
        }
    }

    /// Defines additional types related to [TextAnchor].
    pub mod text_anchor {
        #[allow(unused_imports)]
        use super::*;

        /// A text segment in the
        /// [Document.text][google.cloud.documentai.v1.Document.text]. The indices
        /// may be out of bounds which indicate that the text extends into another
        /// document shard for large sharded documents. See
        /// [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset]
        ///
        /// [google.cloud.documentai.v1.Document.ShardInfo.text_offset]: crate::model::document::ShardInfo::text_offset
        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct TextSegment {
            /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
            /// start UTF-8 char index in the
            /// [Document.text][google.cloud.documentai.v1.Document.text].
            ///
            /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
            /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
            pub start_index: i64,

            /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
            /// half open end UTF-8 char index in the
            /// [Document.text][google.cloud.documentai.v1.Document.text].
            ///
            /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
            /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
            pub end_index: i64,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl TextSegment {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [start_index][crate::model::document::text_anchor::TextSegment::start_index].
            pub fn set_start_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
                self.start_index = v.into();
                self
            }

            /// Sets the value of [end_index][crate::model::document::text_anchor::TextSegment::end_index].
            pub fn set_end_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
                self.end_index = v.into();
                self
            }
        }

        impl wkt::message::Message for TextSegment {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor.TextSegment"
            }
        }
    }

    /// Referencing the visual context of the entity in the
    /// [Document.pages][google.cloud.documentai.v1.Document.pages]. Page anchors
    /// can be cross-page, consist of multiple bounding polygons and optionally
    /// reference specific layout element types.
    ///
    /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct PageAnchor {
        /// One or more references to visual page elements
        pub page_refs: std::vec::Vec<crate::model::document::page_anchor::PageRef>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl PageAnchor {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [page_refs][crate::model::document::PageAnchor::page_refs].
        pub fn set_page_refs<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::page_anchor::PageRef>,
        {
            use std::iter::Iterator;
            self.page_refs = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for PageAnchor {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor"
        }
    }

    /// Defines additional types related to [PageAnchor].
    pub mod page_anchor {
        #[allow(unused_imports)]
        use super::*;

        /// Represents a weak reference to a page element within a document.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct PageRef {
            /// Required. Index into the
            /// [Document.pages][google.cloud.documentai.v1.Document.pages] element,
            /// for example using
            /// `[Document.pages][page_refs.page]` to locate the related page element.
            /// This field is skipped when its value is the default `0`. See
            /// <https://developers.google.com/protocol-buffers/docs/proto3#json>.
            ///
            /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
            pub page: i64,

            /// Optional. The type of the layout element that is being referenced if
            /// any.
            pub layout_type: crate::model::document::page_anchor::page_ref::LayoutType,

            /// Optional. Deprecated.  Use
            /// [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]
            /// instead.
            ///
            /// [google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]: crate::model::document::page_anchor::PageRef::bounding_poly
            #[deprecated]
            pub layout_id: std::string::String,

            /// Optional. Identifies the bounding polygon of a layout element on the
            /// page. If `layout_type` is set, the bounding polygon must be exactly the
            /// same to the layout element it's referring to.
            pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,

            /// Optional. Confidence of detected page element, if applicable. Range
            /// `[0, 1]`.
            pub confidence: f32,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl PageRef {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [page][crate::model::document::page_anchor::PageRef::page].
            pub fn set_page<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
                self.page = v.into();
                self
            }

            /// Sets the value of [layout_type][crate::model::document::page_anchor::PageRef::layout_type].
            pub fn set_layout_type<
                T: std::convert::Into<crate::model::document::page_anchor::page_ref::LayoutType>,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.layout_type = v.into();
                self
            }

            /// Sets the value of [layout_id][crate::model::document::page_anchor::PageRef::layout_id].
            #[deprecated]
            pub fn set_layout_id<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.layout_id = v.into();
                self
            }

            /// Sets the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
            pub fn set_bounding_poly<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::BoundingPoly>,
            {
                self.bounding_poly = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
            pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::BoundingPoly>,
            {
                self.bounding_poly = v.map(|x| x.into());
                self
            }

            /// Sets the value of [confidence][crate::model::document::page_anchor::PageRef::confidence].
            pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
                self.confidence = v.into();
                self
            }
        }

        impl wkt::message::Message for PageRef {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor.PageRef"
            }
        }

        /// Defines additional types related to [PageRef].
        pub mod page_ref {
            #[allow(unused_imports)]
            use super::*;

            /// The type of layout that is being referenced.
            ///
            /// # Working with unknown values
            ///
            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
            /// additional enum variants at any time. Adding new variants is not considered
            /// a breaking change. Applications should write their code in anticipation of:
            ///
            /// - New values appearing in future releases of the client library, **and**
            /// - New values received dynamically, without application changes.
            ///
            /// Please consult the [Working with enums] section in the user guide for some
            /// guidelines.
            ///
            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum LayoutType {
                /// Layout Unspecified.
                Unspecified,
                /// References a
                /// [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks]
                /// element.
                ///
                /// [google.cloud.documentai.v1.Document.Page.blocks]: crate::model::document::Page::blocks
                Block,
                /// References a
                /// [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs]
                /// element.
                ///
                /// [google.cloud.documentai.v1.Document.Page.paragraphs]: crate::model::document::Page::paragraphs
                Paragraph,
                /// References a
                /// [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element.
                ///
                /// [google.cloud.documentai.v1.Document.Page.lines]: crate::model::document::Page::lines
                Line,
                /// References a
                /// [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens]
                /// element.
                ///
                /// [google.cloud.documentai.v1.Document.Page.tokens]: crate::model::document::Page::tokens
                Token,
                /// References a
                /// [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements]
                /// element.
                ///
                /// [google.cloud.documentai.v1.Document.Page.visual_elements]: crate::model::document::Page::visual_elements
                VisualElement,
                /// Refrrences a
                /// [Page.tables][google.cloud.documentai.v1.Document.Page.tables]
                /// element.
                ///
                /// [google.cloud.documentai.v1.Document.Page.tables]: crate::model::document::Page::tables
                Table,
                /// References a
                /// [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields]
                /// element.
                ///
                /// [google.cloud.documentai.v1.Document.Page.form_fields]: crate::model::document::Page::form_fields
                FormField,
                /// If set, the enum was initialized with an unknown value.
                ///
                /// Applications can examine the value using [LayoutType::value] or
                /// [LayoutType::name].
                UnknownValue(layout_type::UnknownValue),
            }

            #[doc(hidden)]
            pub mod layout_type {
                #[allow(unused_imports)]
                use super::*;
                #[derive(Clone, Debug, PartialEq)]
                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
            }

            impl LayoutType {
                /// Gets the enum value.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the string representation of enums.
                pub fn value(&self) -> std::option::Option<i32> {
                    match self {
                        Self::Unspecified => std::option::Option::Some(0),
                        Self::Block => std::option::Option::Some(1),
                        Self::Paragraph => std::option::Option::Some(2),
                        Self::Line => std::option::Option::Some(3),
                        Self::Token => std::option::Option::Some(4),
                        Self::VisualElement => std::option::Option::Some(5),
                        Self::Table => std::option::Option::Some(6),
                        Self::FormField => std::option::Option::Some(7),
                        Self::UnknownValue(u) => u.0.value(),
                    }
                }

                /// Gets the enum value as a string.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the integer representation of enums.
                pub fn name(&self) -> std::option::Option<&str> {
                    match self {
                        Self::Unspecified => std::option::Option::Some("LAYOUT_TYPE_UNSPECIFIED"),
                        Self::Block => std::option::Option::Some("BLOCK"),
                        Self::Paragraph => std::option::Option::Some("PARAGRAPH"),
                        Self::Line => std::option::Option::Some("LINE"),
                        Self::Token => std::option::Option::Some("TOKEN"),
                        Self::VisualElement => std::option::Option::Some("VISUAL_ELEMENT"),
                        Self::Table => std::option::Option::Some("TABLE"),
                        Self::FormField => std::option::Option::Some("FORM_FIELD"),
                        Self::UnknownValue(u) => u.0.name(),
                    }
                }
            }

            impl std::default::Default for LayoutType {
                fn default() -> Self {
                    use std::convert::From;
                    Self::from(0)
                }
            }

            impl std::fmt::Display for LayoutType {
                fn fmt(
                    &self,
                    f: &mut std::fmt::Formatter<'_>,
                ) -> std::result::Result<(), std::fmt::Error> {
                    wkt::internal::display_enum(f, self.name(), self.value())
                }
            }

            impl std::convert::From<i32> for LayoutType {
                fn from(value: i32) -> Self {
                    match value {
                        0 => Self::Unspecified,
                        1 => Self::Block,
                        2 => Self::Paragraph,
                        3 => Self::Line,
                        4 => Self::Token,
                        5 => Self::VisualElement,
                        6 => Self::Table,
                        7 => Self::FormField,
                        _ => Self::UnknownValue(layout_type::UnknownValue(
                            wkt::internal::UnknownEnumValue::Integer(value),
                        )),
                    }
                }
            }

            impl std::convert::From<&str> for LayoutType {
                fn from(value: &str) -> Self {
                    use std::string::ToString;
                    match value {
                        "LAYOUT_TYPE_UNSPECIFIED" => Self::Unspecified,
                        "BLOCK" => Self::Block,
                        "PARAGRAPH" => Self::Paragraph,
                        "LINE" => Self::Line,
                        "TOKEN" => Self::Token,
                        "VISUAL_ELEMENT" => Self::VisualElement,
                        "TABLE" => Self::Table,
                        "FORM_FIELD" => Self::FormField,
                        _ => Self::UnknownValue(layout_type::UnknownValue(
                            wkt::internal::UnknownEnumValue::String(value.to_string()),
                        )),
                    }
                }
            }

            impl serde::ser::Serialize for LayoutType {
                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
                where
                    S: serde::Serializer,
                {
                    match self {
                        Self::Unspecified => serializer.serialize_i32(0),
                        Self::Block => serializer.serialize_i32(1),
                        Self::Paragraph => serializer.serialize_i32(2),
                        Self::Line => serializer.serialize_i32(3),
                        Self::Token => serializer.serialize_i32(4),
                        Self::VisualElement => serializer.serialize_i32(5),
                        Self::Table => serializer.serialize_i32(6),
                        Self::FormField => serializer.serialize_i32(7),
                        Self::UnknownValue(u) => u.0.serialize(serializer),
                    }
                }
            }

            impl<'de> serde::de::Deserialize<'de> for LayoutType {
                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
                where
                    D: serde::Deserializer<'de>,
                {
                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<LayoutType>::new(
                        ".google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType",
                    ))
                }
            }
        }
    }

    /// Structure to identify provenance relationships between annotations in
    /// different revisions.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Provenance {
        /// The index of the revision that produced this element.
        #[deprecated]
        pub revision: i32,

        /// The Id of this operation.  Needs to be unique within the scope of the
        /// revision.
        #[deprecated]
        pub id: i32,

        /// References to the original elements that are replaced.
        pub parents: std::vec::Vec<crate::model::document::provenance::Parent>,

        /// The type of provenance operation.
        pub r#type: crate::model::document::provenance::OperationType,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Provenance {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [revision][crate::model::document::Provenance::revision].
        #[deprecated]
        pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.revision = v.into();
            self
        }

        /// Sets the value of [id][crate::model::document::Provenance::id].
        #[deprecated]
        pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.id = v.into();
            self
        }

        /// Sets the value of [parents][crate::model::document::Provenance::parents].
        pub fn set_parents<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::provenance::Parent>,
        {
            use std::iter::Iterator;
            self.parents = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [r#type][crate::model::document::Provenance::type].
        pub fn set_type<
            T: std::convert::Into<crate::model::document::provenance::OperationType>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.r#type = v.into();
            self
        }
    }

    impl wkt::message::Message for Provenance {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance"
        }
    }

    /// Defines additional types related to [Provenance].
    pub mod provenance {
        #[allow(unused_imports)]
        use super::*;

        /// The parent element the current element is based on. Used for
        /// referencing/aligning, removal and replacement operations.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Parent {
            /// The index of the index into current revision's parent_ids list.
            pub revision: i32,

            /// The index of the parent item in the corresponding item list (eg. list
            /// of entities, properties within entities, etc.) in the parent revision.
            pub index: i32,

            /// The id of the parent provenance.
            #[deprecated]
            pub id: i32,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Parent {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [revision][crate::model::document::provenance::Parent::revision].
            pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.revision = v.into();
                self
            }

            /// Sets the value of [index][crate::model::document::provenance::Parent::index].
            pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.index = v.into();
                self
            }

            /// Sets the value of [id][crate::model::document::provenance::Parent::id].
            #[deprecated]
            pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.id = v.into();
                self
            }
        }

        impl wkt::message::Message for Parent {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance.Parent"
            }
        }

        /// If a processor or agent does an explicit operation on existing elements.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum OperationType {
            /// Operation type unspecified. If no operation is specified a provenance
            /// entry is simply used to match against a `parent`.
            Unspecified,
            /// Add an element.
            Add,
            /// Remove an element identified by `parent`.
            Remove,
            /// Updates any fields within the given provenance scope of the message. It
            /// overwrites the fields rather than replacing them.  Use this when you
            /// want to update a field value of an entity without also updating all the
            /// child properties.
            Update,
            /// Currently unused. Replace an element identified by `parent`.
            Replace,
            /// Deprecated. Request human review for the element identified by
            /// `parent`.
            #[deprecated]
            EvalRequested,
            /// Deprecated. Element is reviewed and approved at human review,
            /// confidence will be set to 1.0.
            #[deprecated]
            EvalApproved,
            /// Deprecated. Element is skipped in the validation process.
            #[deprecated]
            EvalSkipped,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [OperationType::value] or
            /// [OperationType::name].
            UnknownValue(operation_type::UnknownValue),
        }

        #[doc(hidden)]
        pub mod operation_type {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl OperationType {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::Add => std::option::Option::Some(1),
                    Self::Remove => std::option::Option::Some(2),
                    Self::Update => std::option::Option::Some(7),
                    Self::Replace => std::option::Option::Some(3),
                    Self::EvalRequested => std::option::Option::Some(4),
                    Self::EvalApproved => std::option::Option::Some(5),
                    Self::EvalSkipped => std::option::Option::Some(6),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
                    Self::Add => std::option::Option::Some("ADD"),
                    Self::Remove => std::option::Option::Some("REMOVE"),
                    Self::Update => std::option::Option::Some("UPDATE"),
                    Self::Replace => std::option::Option::Some("REPLACE"),
                    Self::EvalRequested => std::option::Option::Some("EVAL_REQUESTED"),
                    Self::EvalApproved => std::option::Option::Some("EVAL_APPROVED"),
                    Self::EvalSkipped => std::option::Option::Some("EVAL_SKIPPED"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for OperationType {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for OperationType {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for OperationType {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::Add,
                    2 => Self::Remove,
                    3 => Self::Replace,
                    4 => Self::EvalRequested,
                    5 => Self::EvalApproved,
                    6 => Self::EvalSkipped,
                    7 => Self::Update,
                    _ => Self::UnknownValue(operation_type::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for OperationType {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
                    "ADD" => Self::Add,
                    "REMOVE" => Self::Remove,
                    "UPDATE" => Self::Update,
                    "REPLACE" => Self::Replace,
                    "EVAL_REQUESTED" => Self::EvalRequested,
                    "EVAL_APPROVED" => Self::EvalApproved,
                    "EVAL_SKIPPED" => Self::EvalSkipped,
                    _ => Self::UnknownValue(operation_type::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for OperationType {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::Add => serializer.serialize_i32(1),
                    Self::Remove => serializer.serialize_i32(2),
                    Self::Update => serializer.serialize_i32(7),
                    Self::Replace => serializer.serialize_i32(3),
                    Self::EvalRequested => serializer.serialize_i32(4),
                    Self::EvalApproved => serializer.serialize_i32(5),
                    Self::EvalSkipped => serializer.serialize_i32(6),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for OperationType {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
                    ".google.cloud.documentai.v1.Document.Provenance.OperationType",
                ))
            }
        }
    }

    /// Contains past or forward revisions of this document.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Revision {
        /// Id of the revision, internally generated by doc proto storage.
        /// Unique within the context of the document.
        pub id: std::string::String,

        /// The revisions that this revision is based on.  This can include one or
        /// more parent (when documents are merged.)  This field represents the
        /// index into the `revisions` field.
        #[deprecated]
        pub parent: std::vec::Vec<i32>,

        /// The revisions that this revision is based on. Must include all the ids
        /// that have anything to do with this revision - eg. there are
        /// `provenance.parent.revision` fields that index into this field.
        pub parent_ids: std::vec::Vec<std::string::String>,

        /// The time that the revision was created, internally generated by
        /// doc proto storage at the time of create.
        pub create_time: std::option::Option<wkt::Timestamp>,

        /// Human Review information of this revision.
        pub human_review: std::option::Option<crate::model::document::revision::HumanReview>,

        /// Who/what made the change
        pub source: std::option::Option<crate::model::document::revision::Source>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Revision {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [id][crate::model::document::Revision::id].
        pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.id = v.into();
            self
        }

        /// Sets the value of [parent][crate::model::document::Revision::parent].
        #[deprecated]
        pub fn set_parent<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<i32>,
        {
            use std::iter::Iterator;
            self.parent = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [parent_ids][crate::model::document::Revision::parent_ids].
        pub fn set_parent_ids<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.parent_ids = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [create_time][crate::model::document::Revision::create_time].
        pub fn set_create_time<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.create_time = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [create_time][crate::model::document::Revision::create_time].
        pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.create_time = v.map(|x| x.into());
            self
        }

        /// Sets the value of [human_review][crate::model::document::Revision::human_review].
        pub fn set_human_review<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::revision::HumanReview>,
        {
            self.human_review = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [human_review][crate::model::document::Revision::human_review].
        pub fn set_or_clear_human_review<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::revision::HumanReview>,
        {
            self.human_review = v.map(|x| x.into());
            self
        }

        /// Sets the value of [source][crate::model::document::Revision::source].
        ///
        /// Note that all the setters affecting `source` are mutually
        /// exclusive.
        pub fn set_source<
            T: std::convert::Into<std::option::Option<crate::model::document::revision::Source>>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.source = v.into();
            self
        }

        /// The value of [source][crate::model::document::Revision::source]
        /// if it holds a `Agent`, `None` if the field is not set or
        /// holds a different branch.
        pub fn agent(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.source.as_ref().and_then(|v| match v {
                crate::model::document::revision::Source::Agent(v) => std::option::Option::Some(v),
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [source][crate::model::document::Revision::source]
        /// to hold a `Agent`.
        ///
        /// Note that all the setters affecting `source` are
        /// mutually exclusive.
        pub fn set_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.source = std::option::Option::Some(
                crate::model::document::revision::Source::Agent(v.into()),
            );
            self
        }

        /// The value of [source][crate::model::document::Revision::source]
        /// if it holds a `Processor`, `None` if the field is not set or
        /// holds a different branch.
        pub fn processor(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.source.as_ref().and_then(|v| match v {
                crate::model::document::revision::Source::Processor(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [source][crate::model::document::Revision::source]
        /// to hold a `Processor`.
        ///
        /// Note that all the setters affecting `source` are
        /// mutually exclusive.
        pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.source = std::option::Option::Some(
                crate::model::document::revision::Source::Processor(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for Revision {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.Revision"
        }
    }

    /// Defines additional types related to [Revision].
    pub mod revision {
        #[allow(unused_imports)]
        use super::*;

        /// Human Review information of the document.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct HumanReview {
            /// Human review state. e.g. `requested`, `succeeded`, `rejected`.
            pub state: std::string::String,

            /// A message providing more details about the current state of processing.
            /// For example, the rejection reason when the state is `rejected`.
            pub state_message: std::string::String,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl HumanReview {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [state][crate::model::document::revision::HumanReview::state].
            pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
                self.state = v.into();
                self
            }

            /// Sets the value of [state_message][crate::model::document::revision::HumanReview::state_message].
            pub fn set_state_message<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.state_message = v.into();
                self
            }
        }

        impl wkt::message::Message for HumanReview {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.Revision.HumanReview"
            }
        }

        /// Who/what made the change
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Source {
            /// If the change was made by a person specify the name or id of that
            /// person.
            Agent(std::string::String),
            /// If the annotation was made by processor identify the processor by its
            /// resource name.
            Processor(std::string::String),
        }
    }

    /// This message is used for text changes aka. OCR corrections.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct TextChange {
        /// Provenance of the correction.
        /// Text anchor indexing into the
        /// [Document.text][google.cloud.documentai.v1.Document.text].  There can
        /// only be a single `TextAnchor.text_segments` element.  If the start and
        /// end index of the text segment are the same, the text change is inserted
        /// before that index.
        ///
        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
        pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,

        /// The text that replaces the text identified in the `text_anchor`.
        pub changed_text: std::string::String,

        /// The history of this annotation.
        #[deprecated]
        pub provenance: std::vec::Vec<crate::model::document::Provenance>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl TextChange {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [text_anchor][crate::model::document::TextChange::text_anchor].
        pub fn set_text_anchor<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::TextAnchor>,
        {
            self.text_anchor = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [text_anchor][crate::model::document::TextChange::text_anchor].
        pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::TextAnchor>,
        {
            self.text_anchor = v.map(|x| x.into());
            self
        }

        /// Sets the value of [changed_text][crate::model::document::TextChange::changed_text].
        pub fn set_changed_text<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.changed_text = v.into();
            self
        }

        /// Sets the value of [provenance][crate::model::document::TextChange::provenance].
        #[deprecated]
        pub fn set_provenance<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::Provenance>,
        {
            use std::iter::Iterator;
            self.provenance = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for TextChange {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.TextChange"
        }
    }

    /// Represents the parsed layout of a document as a collection of blocks that
    /// the document is divided into.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct DocumentLayout {
        /// List of blocks in the document.
        pub blocks: std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl DocumentLayout {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [blocks][crate::model::document::DocumentLayout::blocks].
        pub fn set_blocks<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::document_layout::DocumentLayoutBlock>,
        {
            use std::iter::Iterator;
            self.blocks = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for DocumentLayout {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout"
        }
    }

    /// Defines additional types related to [DocumentLayout].
    pub mod document_layout {
        #[allow(unused_imports)]
        use super::*;

        /// Represents a block. A block could be one of the various types (text,
        /// table, list) supported.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct DocumentLayoutBlock {
            /// ID of the block.
            pub block_id: std::string::String,

            /// Page span of the block.
            pub page_span: std::option::Option<
                crate::model::document::document_layout::document_layout_block::LayoutPageSpan,
            >,

            /// Identifies the bounding box for the block.
            pub bounding_box: std::option::Option<crate::model::BoundingPoly>,

            pub block: std::option::Option<
                crate::model::document::document_layout::document_layout_block::Block,
            >,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl DocumentLayoutBlock {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [block_id][crate::model::document::document_layout::DocumentLayoutBlock::block_id].
            pub fn set_block_id<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.block_id = v.into();
                self
            }

            /// Sets the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
            pub fn set_page_span<T>(mut self, v: T) -> Self
            where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
            {
                self.page_span = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
            pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
            where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
            {
                self.page_span = v.map(|x| x.into());
                self
            }

            /// Sets the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
            pub fn set_bounding_box<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::BoundingPoly>,
            {
                self.bounding_box = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
            pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::BoundingPoly>,
            {
                self.bounding_box = v.map(|x| x.into());
                self
            }

            /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block].
            ///
            /// Note that all the setters affecting `block` are mutually
            /// exclusive.
            pub fn set_block<
                T: std::convert::Into<
                        std::option::Option<
                            crate::model::document::document_layout::document_layout_block::Block,
                        >,
                    >,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.block = v.into();
                self
            }

            /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
            /// if it holds a `TextBlock`, `None` if the field is not set or
            /// holds a different branch.
            pub fn text_block(
                &self,
            ) -> std::option::Option<
                &std::boxed::Box<
                    crate::model::document::document_layout::document_layout_block::LayoutTextBlock,
                >,
            > {
                #[allow(unreachable_patterns)]
                self.block.as_ref().and_then(|v| match v {
                    crate::model::document::document_layout::document_layout_block::Block::TextBlock(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
            /// to hold a `TextBlock`.
            ///
            /// Note that all the setters affecting `block` are
            /// mutually exclusive.
            pub fn set_text_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>>>(mut self, v: T) -> Self{
                self.block = std::option::Option::Some(
                    crate::model::document::document_layout::document_layout_block::Block::TextBlock(
                        v.into()
                    )
                );
                self
            }

            /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
            /// if it holds a `TableBlock`, `None` if the field is not set or
            /// holds a different branch.
            pub fn table_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>{
                #[allow(unreachable_patterns)]
                self.block.as_ref().and_then(|v| match v {
                    crate::model::document::document_layout::document_layout_block::Block::TableBlock(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
            /// to hold a `TableBlock`.
            ///
            /// Note that all the setters affecting `block` are
            /// mutually exclusive.
            pub fn set_table_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>>(mut self, v: T) -> Self{
                self.block = std::option::Option::Some(
                    crate::model::document::document_layout::document_layout_block::Block::TableBlock(
                        v.into()
                    )
                );
                self
            }

            /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
            /// if it holds a `ListBlock`, `None` if the field is not set or
            /// holds a different branch.
            pub fn list_block(
                &self,
            ) -> std::option::Option<
                &std::boxed::Box<
                    crate::model::document::document_layout::document_layout_block::LayoutListBlock,
                >,
            > {
                #[allow(unreachable_patterns)]
                self.block.as_ref().and_then(|v| match v {
                    crate::model::document::document_layout::document_layout_block::Block::ListBlock(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
            /// to hold a `ListBlock`.
            ///
            /// Note that all the setters affecting `block` are
            /// mutually exclusive.
            pub fn set_list_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>>>(mut self, v: T) -> Self{
                self.block = std::option::Option::Some(
                    crate::model::document::document_layout::document_layout_block::Block::ListBlock(
                        v.into()
                    )
                );
                self
            }
        }

        impl wkt::message::Message for DocumentLayoutBlock {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock"
            }
        }

        /// Defines additional types related to [DocumentLayoutBlock].
        pub mod document_layout_block {
            #[allow(unused_imports)]
            use super::*;

            /// Represents where the block starts and ends in the document.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct LayoutPageSpan {
                /// Page where block starts in the document.
                pub page_start: i32,

                /// Page where block ends in the document.
                pub page_end: i32,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl LayoutPageSpan {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [page_start][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_start].
                pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                    self.page_start = v.into();
                    self
                }

                /// Sets the value of [page_end][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_end].
                pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                    self.page_end = v.into();
                    self
                }
            }

            impl wkt::message::Message for LayoutPageSpan {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan"
                }
            }

            /// Represents a text type block.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct LayoutTextBlock {
                /// Text content stored in the block.
                pub text: std::string::String,

                /// Type of the text in the block. Available options are: `paragraph`,
                /// `subtitle`, `heading-1`, `heading-2`, `heading-3`, `heading-4`,
                /// `heading-5`, `header`, `footer`.
                pub r#type: std::string::String,

                /// A text block could further have child blocks.
                /// Repeated blocks support further hierarchies and nested blocks.
                pub blocks:
                    std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl LayoutTextBlock {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [text][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::text].
                pub fn set_text<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.text = v.into();
                    self
                }

                /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::type].
                pub fn set_type<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.r#type = v.into();
                    self
                }

                /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::blocks].
                pub fn set_blocks<T, V>(mut self, v: T) -> Self
                where
                    T: std::iter::IntoIterator<Item = V>,
                    V: std::convert::Into<
                            crate::model::document::document_layout::DocumentLayoutBlock,
                        >,
                {
                    use std::iter::Iterator;
                    self.blocks = v.into_iter().map(|i| i.into()).collect();
                    self
                }
            }

            impl wkt::message::Message for LayoutTextBlock {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock"
                }
            }

            /// Represents a table type block.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct LayoutTableBlock {
                /// Header rows at the top of the table.
                pub header_rows: std::vec::Vec<
                    crate::model::document::document_layout::document_layout_block::LayoutTableRow,
                >,

                /// Body rows containing main table content.
                pub body_rows: std::vec::Vec<
                    crate::model::document::document_layout::document_layout_block::LayoutTableRow,
                >,

                /// Table caption/title.
                pub caption: std::string::String,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl LayoutTableBlock {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [header_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::header_rows].
                pub fn set_header_rows<T, V>(mut self, v: T) -> Self
                where
                    T: std::iter::IntoIterator<Item = V>,
                    V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
                {
                    use std::iter::Iterator;
                    self.header_rows = v.into_iter().map(|i| i.into()).collect();
                    self
                }

                /// Sets the value of [body_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::body_rows].
                pub fn set_body_rows<T, V>(mut self, v: T) -> Self
                where
                    T: std::iter::IntoIterator<Item = V>,
                    V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
                {
                    use std::iter::Iterator;
                    self.body_rows = v.into_iter().map(|i| i.into()).collect();
                    self
                }

                /// Sets the value of [caption][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::caption].
                pub fn set_caption<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.caption = v.into();
                    self
                }
            }

            impl wkt::message::Message for LayoutTableBlock {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock"
                }
            }

            /// Represents a row in a table.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct LayoutTableRow {
                /// A table row is a list of table cells.
                pub cells: std::vec::Vec<
                    crate::model::document::document_layout::document_layout_block::LayoutTableCell,
                >,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl LayoutTableRow {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [cells][crate::model::document::document_layout::document_layout_block::LayoutTableRow::cells].
                pub fn set_cells<T, V>(mut self, v: T) -> Self
                where
                    T: std::iter::IntoIterator<Item = V>,
                    V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableCell>
                {
                    use std::iter::Iterator;
                    self.cells = v.into_iter().map(|i| i.into()).collect();
                    self
                }
            }

            impl wkt::message::Message for LayoutTableRow {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow"
                }
            }

            /// Represents a cell in a table row.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct LayoutTableCell {
                /// A table cell is a list of blocks.
                /// Repeated blocks support further hierarchies and nested blocks.
                pub blocks:
                    std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,

                /// How many rows this cell spans.
                pub row_span: i32,

                /// How many columns this cell spans.
                pub col_span: i32,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl LayoutTableCell {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTableCell::blocks].
                pub fn set_blocks<T, V>(mut self, v: T) -> Self
                where
                    T: std::iter::IntoIterator<Item = V>,
                    V: std::convert::Into<
                            crate::model::document::document_layout::DocumentLayoutBlock,
                        >,
                {
                    use std::iter::Iterator;
                    self.blocks = v.into_iter().map(|i| i.into()).collect();
                    self
                }

                /// Sets the value of [row_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::row_span].
                pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                    self.row_span = v.into();
                    self
                }

                /// Sets the value of [col_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::col_span].
                pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                    self.col_span = v.into();
                    self
                }
            }

            impl wkt::message::Message for LayoutTableCell {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell"
                }
            }

            /// Represents a list type block.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct LayoutListBlock {
                /// List entries that constitute a list block.
                pub list_entries: std::vec::Vec<
                    crate::model::document::document_layout::document_layout_block::LayoutListEntry,
                >,

                /// Type of the list_entries (if exist). Available options are `ordered`
                /// and `unordered`.
                pub r#type: std::string::String,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl LayoutListBlock {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [list_entries][crate::model::document::document_layout::document_layout_block::LayoutListBlock::list_entries].
                pub fn set_list_entries<T, V>(mut self, v: T) -> Self
                where
                    T: std::iter::IntoIterator<Item = V>,
                    V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutListEntry>
                {
                    use std::iter::Iterator;
                    self.list_entries = v.into_iter().map(|i| i.into()).collect();
                    self
                }

                /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutListBlock::type].
                pub fn set_type<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.r#type = v.into();
                    self
                }
            }

            impl wkt::message::Message for LayoutListBlock {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock"
                }
            }

            /// Represents an entry in the list.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct LayoutListEntry {
                /// A list entry is a list of blocks.
                /// Repeated blocks support further hierarchies and nested blocks.
                pub blocks:
                    std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl LayoutListEntry {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutListEntry::blocks].
                pub fn set_blocks<T, V>(mut self, v: T) -> Self
                where
                    T: std::iter::IntoIterator<Item = V>,
                    V: std::convert::Into<
                            crate::model::document::document_layout::DocumentLayoutBlock,
                        >,
                {
                    use std::iter::Iterator;
                    self.blocks = v.into_iter().map(|i| i.into()).collect();
                    self
                }
            }

            impl wkt::message::Message for LayoutListEntry {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry"
                }
            }

            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum Block {
                /// Block consisting of text content.
                TextBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>),
                /// Block consisting of table content/structure.
                TableBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>),
                /// Block consisting of list content/structure.
                ListBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>),
            }
        }
    }

    /// Represents the chunks that the document is divided into.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct ChunkedDocument {
        /// List of chunks.
        pub chunks: std::vec::Vec<crate::model::document::chunked_document::Chunk>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl ChunkedDocument {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [chunks][crate::model::document::ChunkedDocument::chunks].
        pub fn set_chunks<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::chunked_document::Chunk>,
        {
            use std::iter::Iterator;
            self.chunks = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for ChunkedDocument {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument"
        }
    }

    /// Defines additional types related to [ChunkedDocument].
    pub mod chunked_document {
        #[allow(unused_imports)]
        use super::*;

        /// Represents a chunk.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Chunk {
            /// ID of the chunk.
            pub chunk_id: std::string::String,

            /// Unused.
            pub source_block_ids: std::vec::Vec<std::string::String>,

            /// Text content of the chunk.
            pub content: std::string::String,

            /// Page span of the chunk.
            pub page_span:
                std::option::Option<crate::model::document::chunked_document::chunk::ChunkPageSpan>,

            /// Page headers associated with the chunk.
            pub page_headers:
                std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageHeader>,

            /// Page footers associated with the chunk.
            pub page_footers:
                std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageFooter>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Chunk {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [chunk_id][crate::model::document::chunked_document::Chunk::chunk_id].
            pub fn set_chunk_id<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.chunk_id = v.into();
                self
            }

            /// Sets the value of [source_block_ids][crate::model::document::chunked_document::Chunk::source_block_ids].
            pub fn set_source_block_ids<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<std::string::String>,
            {
                use std::iter::Iterator;
                self.source_block_ids = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [content][crate::model::document::chunked_document::Chunk::content].
            pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
                self.content = v.into();
                self
            }

            /// Sets the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
            pub fn set_page_span<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<
                        crate::model::document::chunked_document::chunk::ChunkPageSpan,
                    >,
            {
                self.page_span = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
            pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<
                        crate::model::document::chunked_document::chunk::ChunkPageSpan,
                    >,
            {
                self.page_span = v.map(|x| x.into());
                self
            }

            /// Sets the value of [page_headers][crate::model::document::chunked_document::Chunk::page_headers].
            pub fn set_page_headers<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<
                        crate::model::document::chunked_document::chunk::ChunkPageHeader,
                    >,
            {
                use std::iter::Iterator;
                self.page_headers = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [page_footers][crate::model::document::chunked_document::Chunk::page_footers].
            pub fn set_page_footers<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<
                        crate::model::document::chunked_document::chunk::ChunkPageFooter,
                    >,
            {
                use std::iter::Iterator;
                self.page_footers = v.into_iter().map(|i| i.into()).collect();
                self
            }
        }

        impl wkt::message::Message for Chunk {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk"
            }
        }

        /// Defines additional types related to [Chunk].
        pub mod chunk {
            #[allow(unused_imports)]
            use super::*;

            /// Represents where the chunk starts and ends in the document.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct ChunkPageSpan {
                /// Page where chunk starts in the document.
                pub page_start: i32,

                /// Page where chunk ends in the document.
                pub page_end: i32,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl ChunkPageSpan {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [page_start][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_start].
                pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                    self.page_start = v.into();
                    self
                }

                /// Sets the value of [page_end][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_end].
                pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                    self.page_end = v.into();
                    self
                }
            }

            impl wkt::message::Message for ChunkPageSpan {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan"
                }
            }

            /// Represents the page header associated with the chunk.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct ChunkPageHeader {
                /// Header in text format.
                pub text: std::string::String,

                /// Page span of the header.
                pub page_span: std::option::Option<
                    crate::model::document::chunked_document::chunk::ChunkPageSpan,
                >,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl ChunkPageHeader {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageHeader::text].
                pub fn set_text<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.text = v.into();
                    self
                }

                /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
                pub fn set_page_span<T>(mut self, v: T) -> Self
                where
                    T: std::convert::Into<
                            crate::model::document::chunked_document::chunk::ChunkPageSpan,
                        >,
                {
                    self.page_span = std::option::Option::Some(v.into());
                    self
                }

                /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
                pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
                where
                    T: std::convert::Into<
                            crate::model::document::chunked_document::chunk::ChunkPageSpan,
                        >,
                {
                    self.page_span = v.map(|x| x.into());
                    self
                }
            }

            impl wkt::message::Message for ChunkPageHeader {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader"
                }
            }

            /// Represents the page footer associated with the chunk.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct ChunkPageFooter {
                /// Footer in text format.
                pub text: std::string::String,

                /// Page span of the footer.
                pub page_span: std::option::Option<
                    crate::model::document::chunked_document::chunk::ChunkPageSpan,
                >,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl ChunkPageFooter {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageFooter::text].
                pub fn set_text<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.text = v.into();
                    self
                }

                /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
                pub fn set_page_span<T>(mut self, v: T) -> Self
                where
                    T: std::convert::Into<
                            crate::model::document::chunked_document::chunk::ChunkPageSpan,
                        >,
                {
                    self.page_span = std::option::Option::Some(v.into());
                    self
                }

                /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
                pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
                where
                    T: std::convert::Into<
                            crate::model::document::chunked_document::chunk::ChunkPageSpan,
                        >,
                {
                    self.page_span = v.map(|x| x.into());
                    self
                }
            }

            impl wkt::message::Message for ChunkPageFooter {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter"
                }
            }
        }
    }

    /// The output of the validation given the document and the validation rules.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct EntityValidationOutput {
        /// The result of each validation rule.
        pub validation_results:
            std::vec::Vec<crate::model::document::entity_validation_output::ValidationResult>,

        /// The overall result of the validation, true if all applicable rules are
        /// valid.
        pub pass_all_rules: bool,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl EntityValidationOutput {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [validation_results][crate::model::document::EntityValidationOutput::validation_results].
        pub fn set_validation_results<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<
                    crate::model::document::entity_validation_output::ValidationResult,
                >,
        {
            use std::iter::Iterator;
            self.validation_results = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [pass_all_rules][crate::model::document::EntityValidationOutput::pass_all_rules].
        pub fn set_pass_all_rules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.pass_all_rules = v.into();
            self
        }
    }

    impl wkt::message::Message for EntityValidationOutput {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput"
        }
    }

    /// Defines additional types related to [EntityValidationOutput].
    pub mod entity_validation_output {
        #[allow(unused_imports)]
        use super::*;

        /// Validation result for a single validation rule.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct ValidationResult {

            /// The name of the validation rule.
            pub rule_name: std::string::String,

            /// The description of the validation rule.
            pub rule_description: std::string::String,

            /// The result of the validation rule.
            pub validation_result_type: crate::model::document::entity_validation_output::validation_result::ValidationResultType,

            /// The detailed information of the running the validation process using
            /// the entity from the document based on the validation rule.
            pub validation_details: std::string::String,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl ValidationResult {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [rule_name][crate::model::document::entity_validation_output::ValidationResult::rule_name].
            pub fn set_rule_name<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.rule_name = v.into();
                self
            }

            /// Sets the value of [rule_description][crate::model::document::entity_validation_output::ValidationResult::rule_description].
            pub fn set_rule_description<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.rule_description = v.into();
                self
            }

            /// Sets the value of [validation_result_type][crate::model::document::entity_validation_output::ValidationResult::validation_result_type].
            pub fn set_validation_result_type<T: std::convert::Into<crate::model::document::entity_validation_output::validation_result::ValidationResultType>>(mut self, v: T) -> Self{
                self.validation_result_type = v.into();
                self
            }

            /// Sets the value of [validation_details][crate::model::document::entity_validation_output::ValidationResult::validation_details].
            pub fn set_validation_details<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.validation_details = v.into();
                self
            }
        }

        impl wkt::message::Message for ValidationResult {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult"
            }
        }

        /// Defines additional types related to [ValidationResult].
        pub mod validation_result {
            #[allow(unused_imports)]
            use super::*;

            /// The result of the validation rule.
            ///
            /// # Working with unknown values
            ///
            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
            /// additional enum variants at any time. Adding new variants is not considered
            /// a breaking change. Applications should write their code in anticipation of:
            ///
            /// - New values appearing in future releases of the client library, **and**
            /// - New values received dynamically, without application changes.
            ///
            /// Please consult the [Working with enums] section in the user guide for some
            /// guidelines.
            ///
            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum ValidationResultType {
                /// The validation result type is unspecified.
                Unspecified,
                /// The validation is valid.
                Valid,
                /// The validation is invalid.
                Invalid,
                /// The validation is skipped.
                Skipped,
                /// The validation is not applicable.
                NotApplicable,
                /// If set, the enum was initialized with an unknown value.
                ///
                /// Applications can examine the value using [ValidationResultType::value] or
                /// [ValidationResultType::name].
                UnknownValue(validation_result_type::UnknownValue),
            }

            #[doc(hidden)]
            pub mod validation_result_type {
                #[allow(unused_imports)]
                use super::*;
                #[derive(Clone, Debug, PartialEq)]
                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
            }

            impl ValidationResultType {
                /// Gets the enum value.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the string representation of enums.
                pub fn value(&self) -> std::option::Option<i32> {
                    match self {
                        Self::Unspecified => std::option::Option::Some(0),
                        Self::Valid => std::option::Option::Some(1),
                        Self::Invalid => std::option::Option::Some(2),
                        Self::Skipped => std::option::Option::Some(3),
                        Self::NotApplicable => std::option::Option::Some(4),
                        Self::UnknownValue(u) => u.0.value(),
                    }
                }

                /// Gets the enum value as a string.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the integer representation of enums.
                pub fn name(&self) -> std::option::Option<&str> {
                    match self {
                        Self::Unspecified => {
                            std::option::Option::Some("VALIDATION_RESULT_TYPE_UNSPECIFIED")
                        }
                        Self::Valid => std::option::Option::Some("VALIDATION_RESULT_TYPE_VALID"),
                        Self::Invalid => {
                            std::option::Option::Some("VALIDATION_RESULT_TYPE_INVALID")
                        }
                        Self::Skipped => {
                            std::option::Option::Some("VALIDATION_RESULT_TYPE_SKIPPED")
                        }
                        Self::NotApplicable => {
                            std::option::Option::Some("VALIDATION_RESULT_TYPE_NOT_APPLICABLE")
                        }
                        Self::UnknownValue(u) => u.0.name(),
                    }
                }
            }

            impl std::default::Default for ValidationResultType {
                fn default() -> Self {
                    use std::convert::From;
                    Self::from(0)
                }
            }

            impl std::fmt::Display for ValidationResultType {
                fn fmt(
                    &self,
                    f: &mut std::fmt::Formatter<'_>,
                ) -> std::result::Result<(), std::fmt::Error> {
                    wkt::internal::display_enum(f, self.name(), self.value())
                }
            }

            impl std::convert::From<i32> for ValidationResultType {
                fn from(value: i32) -> Self {
                    match value {
                        0 => Self::Unspecified,
                        1 => Self::Valid,
                        2 => Self::Invalid,
                        3 => Self::Skipped,
                        4 => Self::NotApplicable,
                        _ => Self::UnknownValue(validation_result_type::UnknownValue(
                            wkt::internal::UnknownEnumValue::Integer(value),
                        )),
                    }
                }
            }

            impl std::convert::From<&str> for ValidationResultType {
                fn from(value: &str) -> Self {
                    use std::string::ToString;
                    match value {
                        "VALIDATION_RESULT_TYPE_UNSPECIFIED" => Self::Unspecified,
                        "VALIDATION_RESULT_TYPE_VALID" => Self::Valid,
                        "VALIDATION_RESULT_TYPE_INVALID" => Self::Invalid,
                        "VALIDATION_RESULT_TYPE_SKIPPED" => Self::Skipped,
                        "VALIDATION_RESULT_TYPE_NOT_APPLICABLE" => Self::NotApplicable,
                        _ => Self::UnknownValue(validation_result_type::UnknownValue(
                            wkt::internal::UnknownEnumValue::String(value.to_string()),
                        )),
                    }
                }
            }

            impl serde::ser::Serialize for ValidationResultType {
                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
                where
                    S: serde::Serializer,
                {
                    match self {
                        Self::Unspecified => serializer.serialize_i32(0),
                        Self::Valid => serializer.serialize_i32(1),
                        Self::Invalid => serializer.serialize_i32(2),
                        Self::Skipped => serializer.serialize_i32(3),
                        Self::NotApplicable => serializer.serialize_i32(4),
                        Self::UnknownValue(u) => u.0.serialize(serializer),
                    }
                }
            }

            impl<'de> serde::de::Deserialize<'de> for ValidationResultType {
                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
                where
                    D: serde::Deserializer<'de>,
                {
                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValidationResultType>::new(
                        ".google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult.ValidationResultType"))
                }
            }
        }
    }

    /// Entity revision.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct EntitiesRevision {
        /// The revision id.
        pub revision_id: std::string::String,

        /// The entities in this revision.
        pub entities: std::vec::Vec<crate::model::document::Entity>,

        /// The entity validation output for this revision.
        pub entity_validation_output:
            std::option::Option<crate::model::document::EntityValidationOutput>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl EntitiesRevision {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [revision_id][crate::model::document::EntitiesRevision::revision_id].
        pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.revision_id = v.into();
            self
        }

        /// Sets the value of [entities][crate::model::document::EntitiesRevision::entities].
        pub fn set_entities<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document::Entity>,
        {
            use std::iter::Iterator;
            self.entities = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
        pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::document::EntityValidationOutput>,
        {
            self.entity_validation_output = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
        pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::document::EntityValidationOutput>,
        {
            self.entity_validation_output = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for EntitiesRevision {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Document.EntitiesRevision"
        }
    }

    /// Original source document from the user.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// Optional. Currently supports Google Cloud Storage URI of the form
        /// `gs://bucket_name/object_name`. Object versioning is not supported.
        /// For more information, refer to [Google Cloud Storage Request
        /// URIs](https://cloud.google.com/storage/docs/reference-uris).
        Uri(std::string::String),
        /// Optional. Inline document content, represented as a stream of bytes.
        /// Note: As with all `bytes` fields, protobuffers use a pure binary
        /// representation, whereas JSON representations use base64.
        Content(::bytes::Bytes),
    }
}

/// Payload message of raw document content (bytes).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RawDocument {
    /// Inline document content.
    pub content: ::bytes::Bytes,

    /// An IANA MIME type (RFC6838) indicating the nature and format of the
    /// [content][google.cloud.documentai.v1.RawDocument.content].
    ///
    /// [google.cloud.documentai.v1.RawDocument.content]: crate::model::RawDocument::content
    pub mime_type: std::string::String,

    /// The display name of the document, it supports all Unicode characters except
    /// the following:
    /// `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,`
    /// `~`, `=` and `:` are reserved.
    /// If not specified, a default ID is generated.
    pub display_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RawDocument {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [content][crate::model::RawDocument::content].
    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.content = v.into();
        self
    }

    /// Sets the value of [mime_type][crate::model::RawDocument::mime_type].
    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.mime_type = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::RawDocument::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }
}

impl wkt::message::Message for RawDocument {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.RawDocument"
    }
}

/// Specifies a document stored on Cloud Storage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcsDocument {
    /// The Cloud Storage object uri.
    pub gcs_uri: std::string::String,

    /// An IANA MIME type (RFC6838) of the content.
    pub mime_type: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GcsDocument {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [gcs_uri][crate::model::GcsDocument::gcs_uri].
    pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.gcs_uri = v.into();
        self
    }

    /// Sets the value of [mime_type][crate::model::GcsDocument::mime_type].
    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.mime_type = v.into();
        self
    }
}

impl wkt::message::Message for GcsDocument {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.GcsDocument"
    }
}

/// Specifies a set of documents on Cloud Storage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcsDocuments {
    /// The list of documents.
    pub documents: std::vec::Vec<crate::model::GcsDocument>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GcsDocuments {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [documents][crate::model::GcsDocuments::documents].
    pub fn set_documents<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::GcsDocument>,
    {
        use std::iter::Iterator;
        self.documents = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for GcsDocuments {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.GcsDocuments"
    }
}

/// Specifies all documents on Cloud Storage with a common prefix.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcsPrefix {
    /// The URI prefix.
    pub gcs_uri_prefix: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GcsPrefix {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [gcs_uri_prefix][crate::model::GcsPrefix::gcs_uri_prefix].
    pub fn set_gcs_uri_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.gcs_uri_prefix = v.into();
        self
    }
}

impl wkt::message::Message for GcsPrefix {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.GcsPrefix"
    }
}

/// The common config to specify a set of documents used as input.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchDocumentsInputConfig {
    /// The source. Make sure that the caller of the API has storage.objects.get
    /// access to the buckets.
    pub source: std::option::Option<crate::model::batch_documents_input_config::Source>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BatchDocumentsInputConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<
        T: std::convert::Into<std::option::Option<crate::model::batch_documents_input_config::Source>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
    /// if it holds a `GcsPrefix`, `None` if the field is not set or
    /// holds a different branch.
    pub fn gcs_prefix(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsPrefix>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::batch_documents_input_config::Source::GcsPrefix(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
    /// to hold a `GcsPrefix`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_gcs_prefix<T: std::convert::Into<std::boxed::Box<crate::model::GcsPrefix>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::batch_documents_input_config::Source::GcsPrefix(v.into()),
        );
        self
    }

    /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
    /// if it holds a `GcsDocuments`, `None` if the field is not set or
    /// holds a different branch.
    pub fn gcs_documents(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocuments>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::batch_documents_input_config::Source::GcsDocuments(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
    /// to hold a `GcsDocuments`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_gcs_documents<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocuments>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::batch_documents_input_config::Source::GcsDocuments(v.into()),
        );
        self
    }
}

impl wkt::message::Message for BatchDocumentsInputConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.BatchDocumentsInputConfig"
    }
}

/// Defines additional types related to [BatchDocumentsInputConfig].
pub mod batch_documents_input_config {
    #[allow(unused_imports)]
    use super::*;

    /// The source. Make sure that the caller of the API has storage.objects.get
    /// access to the buckets.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// The set of documents that match the specified Cloud Storage `gcs_prefix`.
        GcsPrefix(std::boxed::Box<crate::model::GcsPrefix>),
        /// The set of documents individually specified on Cloud Storage.
        GcsDocuments(std::boxed::Box<crate::model::GcsDocuments>),
    }
}

/// Config that controls the output of documents. All documents will be written
/// as a JSON file.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DocumentOutputConfig {
    /// The destination of the results.
    pub destination: std::option::Option<crate::model::document_output_config::Destination>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DocumentOutputConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination].
    ///
    /// Note that all the setters affecting `destination` are mutually
    /// exclusive.
    pub fn set_destination<
        T: std::convert::Into<std::option::Option<crate::model::document_output_config::Destination>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = v.into();
        self
    }

    /// The value of [destination][crate::model::DocumentOutputConfig::destination]
    /// if it holds a `GcsOutputConfig`, `None` if the field is not set or
    /// holds a different branch.
    pub fn gcs_output_config(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>
    {
        #[allow(unreachable_patterns)]
        self.destination.as_ref().and_then(|v| match v {
            crate::model::document_output_config::Destination::GcsOutputConfig(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination]
    /// to hold a `GcsOutputConfig`.
    ///
    /// Note that all the setters affecting `destination` are
    /// mutually exclusive.
    pub fn set_gcs_output_config<
        T: std::convert::Into<std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = std::option::Option::Some(
            crate::model::document_output_config::Destination::GcsOutputConfig(v.into()),
        );
        self
    }
}

impl wkt::message::Message for DocumentOutputConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig"
    }
}

/// Defines additional types related to [DocumentOutputConfig].
pub mod document_output_config {
    #[allow(unused_imports)]
    use super::*;

    /// The configuration used when outputting documents.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct GcsOutputConfig {
        /// The Cloud Storage uri (a directory) of the output.
        pub gcs_uri: std::string::String,

        /// Specifies which fields to include in the output documents.
        /// Only supports top level document and pages field so it must be in the
        /// form of `{document_field_name}` or `pages.{page_field_name}`.
        pub field_mask: std::option::Option<wkt::FieldMask>,

        /// Specifies the sharding config for the output document.
        pub sharding_config: std::option::Option<
            crate::model::document_output_config::gcs_output_config::ShardingConfig,
        >,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl GcsOutputConfig {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [gcs_uri][crate::model::document_output_config::GcsOutputConfig::gcs_uri].
        pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.gcs_uri = v.into();
            self
        }

        /// Sets the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
        pub fn set_field_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.field_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
        pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.field_mask = v.map(|x| x.into());
            self
        }

        /// Sets the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
        pub fn set_sharding_config<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<
                    crate::model::document_output_config::gcs_output_config::ShardingConfig,
                >,
        {
            self.sharding_config = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
        pub fn set_or_clear_sharding_config<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<
                    crate::model::document_output_config::gcs_output_config::ShardingConfig,
                >,
        {
            self.sharding_config = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for GcsOutputConfig {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig"
        }
    }

    /// Defines additional types related to [GcsOutputConfig].
    pub mod gcs_output_config {
        #[allow(unused_imports)]
        use super::*;

        /// The sharding config for the output document.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct ShardingConfig {
            /// The number of pages per shard.
            pub pages_per_shard: i32,

            /// The number of overlapping pages between consecutive shards.
            pub pages_overlap: i32,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl ShardingConfig {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [pages_per_shard][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_per_shard].
            pub fn set_pages_per_shard<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.pages_per_shard = v.into();
                self
            }

            /// Sets the value of [pages_overlap][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_overlap].
            pub fn set_pages_overlap<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.pages_overlap = v.into();
                self
            }
        }

        impl wkt::message::Message for ShardingConfig {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig"
            }
        }
    }

    /// The destination of the results.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Destination {
        /// Output config to write the results to Cloud Storage.
        GcsOutputConfig(std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>),
    }
}

/// Config for Document OCR.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OcrConfig {
    /// Hints for the OCR model.
    pub hints: std::option::Option<crate::model::ocr_config::Hints>,

    /// Enables special handling for PDFs with existing text information. Results
    /// in better text extraction quality in such PDF inputs.
    pub enable_native_pdf_parsing: bool,

    /// Enables intelligent document quality scores after OCR. Can help with
    /// diagnosing why OCR responses are of poor quality for a given input.
    /// Adds additional latency comparable to regular OCR to the process call.
    pub enable_image_quality_scores: bool,

    /// A list of advanced OCR options to further fine-tune OCR behavior. Current
    /// valid values are:
    ///
    /// - `legacy_layout`: a heuristics layout detection algorithm, which serves as
    ///   an alternative to the current ML-based layout detection algorithm.
    ///   Customers can choose the best suitable layout algorithm based on their
    ///   situation.
    pub advanced_ocr_options: std::vec::Vec<std::string::String>,

    /// Includes symbol level OCR information if set to true.
    pub enable_symbol: bool,

    /// Turn on font identification model and return font style information.
    /// Deprecated, use
    /// [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]
    /// instead.
    ///
    /// [google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]: crate::model::ocr_config::PremiumFeatures::compute_style_info
    #[deprecated]
    pub compute_style_info: bool,

    /// Turn off character box detector in OCR engine. Character box detection is
    /// enabled by default in OCR 2.0 (and later) processors.
    pub disable_character_boxes_detection: bool,

    /// Configurations for premium OCR features.
    pub premium_features: std::option::Option<crate::model::ocr_config::PremiumFeatures>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OcrConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [hints][crate::model::OcrConfig::hints].
    pub fn set_hints<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ocr_config::Hints>,
    {
        self.hints = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [hints][crate::model::OcrConfig::hints].
    pub fn set_or_clear_hints<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ocr_config::Hints>,
    {
        self.hints = v.map(|x| x.into());
        self
    }

    /// Sets the value of [enable_native_pdf_parsing][crate::model::OcrConfig::enable_native_pdf_parsing].
    pub fn set_enable_native_pdf_parsing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enable_native_pdf_parsing = v.into();
        self
    }

    /// Sets the value of [enable_image_quality_scores][crate::model::OcrConfig::enable_image_quality_scores].
    pub fn set_enable_image_quality_scores<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enable_image_quality_scores = v.into();
        self
    }

    /// Sets the value of [advanced_ocr_options][crate::model::OcrConfig::advanced_ocr_options].
    pub fn set_advanced_ocr_options<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.advanced_ocr_options = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [enable_symbol][crate::model::OcrConfig::enable_symbol].
    pub fn set_enable_symbol<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enable_symbol = v.into();
        self
    }

    /// Sets the value of [compute_style_info][crate::model::OcrConfig::compute_style_info].
    #[deprecated]
    pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.compute_style_info = v.into();
        self
    }

    /// Sets the value of [disable_character_boxes_detection][crate::model::OcrConfig::disable_character_boxes_detection].
    pub fn set_disable_character_boxes_detection<T: std::convert::Into<bool>>(
        mut self,
        v: T,
    ) -> Self {
        self.disable_character_boxes_detection = v.into();
        self
    }

    /// Sets the value of [premium_features][crate::model::OcrConfig::premium_features].
    pub fn set_premium_features<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
    {
        self.premium_features = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [premium_features][crate::model::OcrConfig::premium_features].
    pub fn set_or_clear_premium_features<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
    {
        self.premium_features = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for OcrConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.OcrConfig"
    }
}

/// Defines additional types related to [OcrConfig].
pub mod ocr_config {
    #[allow(unused_imports)]
    use super::*;

    /// Hints for OCR Engine
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Hints {
        /// List of BCP-47 language codes to use for OCR. In most cases, not
        /// specifying it yields the best results since it enables automatic language
        /// detection. For languages based on the Latin alphabet, setting hints is
        /// not needed. In rare cases, when the language of the text in the
        /// image is known, setting a hint will help get better results (although it
        /// will be a significant hindrance if the hint is wrong).
        pub language_hints: std::vec::Vec<std::string::String>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Hints {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [language_hints][crate::model::ocr_config::Hints::language_hints].
        pub fn set_language_hints<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.language_hints = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for Hints {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.Hints"
        }
    }

    /// Configurations for premium OCR features.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct PremiumFeatures {
        /// Turn on selection mark detector in OCR engine. Only available in OCR 2.0
        /// (and later) processors.
        pub enable_selection_mark_detection: bool,

        /// Turn on font identification model and return font style information.
        pub compute_style_info: bool,

        /// Turn on the model that can extract LaTeX math formulas.
        pub enable_math_ocr: bool,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl PremiumFeatures {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [enable_selection_mark_detection][crate::model::ocr_config::PremiumFeatures::enable_selection_mark_detection].
        pub fn set_enable_selection_mark_detection<T: std::convert::Into<bool>>(
            mut self,
            v: T,
        ) -> Self {
            self.enable_selection_mark_detection = v.into();
            self
        }

        /// Sets the value of [compute_style_info][crate::model::ocr_config::PremiumFeatures::compute_style_info].
        pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.compute_style_info = v.into();
            self
        }

        /// Sets the value of [enable_math_ocr][crate::model::ocr_config::PremiumFeatures::enable_math_ocr].
        pub fn set_enable_math_ocr<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.enable_math_ocr = v.into();
            self
        }
    }

    impl wkt::message::Message for PremiumFeatures {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.PremiumFeatures"
        }
    }
}

/// Options for Process API
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProcessOptions {
    /// Only applicable to `OCR_PROCESSOR` and `FORM_PARSER_PROCESSOR`.
    /// Returns error if set on other processor types.
    pub ocr_config: std::option::Option<crate::model::OcrConfig>,

    /// Optional. Only applicable to `LAYOUT_PARSER_PROCESSOR`.
    /// Returns error if set on other processor types.
    pub layout_config: std::option::Option<crate::model::process_options::LayoutConfig>,

    /// Optional. Override the schema of the
    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. Will
    /// return an Invalid Argument error if this field is set when the underlying
    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] doesn't
    /// support schema override.
    ///
    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
    pub schema_override: std::option::Option<crate::model::DocumentSchema>,

    /// A subset of pages to process. If not specified, all pages are processed.
    /// If a page range is set, only the given pages are extracted and processed
    /// from the document. In the output document,
    /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
    /// refers to the page number in the original document.
    /// This configuration only applies to online processing with
    /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
    ///
    /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
    /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
    pub page_range: std::option::Option<crate::model::process_options::PageRange>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ProcessOptions {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
    pub fn set_ocr_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::OcrConfig>,
    {
        self.ocr_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
    pub fn set_or_clear_ocr_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::OcrConfig>,
    {
        self.ocr_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [layout_config][crate::model::ProcessOptions::layout_config].
    pub fn set_layout_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::process_options::LayoutConfig>,
    {
        self.layout_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [layout_config][crate::model::ProcessOptions::layout_config].
    pub fn set_or_clear_layout_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::process_options::LayoutConfig>,
    {
        self.layout_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [schema_override][crate::model::ProcessOptions::schema_override].
    pub fn set_schema_override<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DocumentSchema>,
    {
        self.schema_override = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [schema_override][crate::model::ProcessOptions::schema_override].
    pub fn set_or_clear_schema_override<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DocumentSchema>,
    {
        self.schema_override = v.map(|x| x.into());
        self
    }

    /// Sets the value of [page_range][crate::model::ProcessOptions::page_range].
    ///
    /// Note that all the setters affecting `page_range` are mutually
    /// exclusive.
    pub fn set_page_range<
        T: std::convert::Into<std::option::Option<crate::model::process_options::PageRange>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.page_range = v.into();
        self
    }

    /// The value of [page_range][crate::model::ProcessOptions::page_range]
    /// if it holds a `IndividualPageSelector`, `None` if the field is not set or
    /// holds a different branch.
    pub fn individual_page_selector(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::process_options::IndividualPageSelector>>
    {
        #[allow(unreachable_patterns)]
        self.page_range.as_ref().and_then(|v| match v {
            crate::model::process_options::PageRange::IndividualPageSelector(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
    /// to hold a `IndividualPageSelector`.
    ///
    /// Note that all the setters affecting `page_range` are
    /// mutually exclusive.
    pub fn set_individual_page_selector<
        T: std::convert::Into<std::boxed::Box<crate::model::process_options::IndividualPageSelector>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.page_range = std::option::Option::Some(
            crate::model::process_options::PageRange::IndividualPageSelector(v.into()),
        );
        self
    }

    /// The value of [page_range][crate::model::ProcessOptions::page_range]
    /// if it holds a `FromStart`, `None` if the field is not set or
    /// holds a different branch.
    pub fn from_start(&self) -> std::option::Option<&i32> {
        #[allow(unreachable_patterns)]
        self.page_range.as_ref().and_then(|v| match v {
            crate::model::process_options::PageRange::FromStart(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
    /// to hold a `FromStart`.
    ///
    /// Note that all the setters affecting `page_range` are
    /// mutually exclusive.
    pub fn set_from_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_range = std::option::Option::Some(
            crate::model::process_options::PageRange::FromStart(v.into()),
        );
        self
    }

    /// The value of [page_range][crate::model::ProcessOptions::page_range]
    /// if it holds a `FromEnd`, `None` if the field is not set or
    /// holds a different branch.
    pub fn from_end(&self) -> std::option::Option<&i32> {
        #[allow(unreachable_patterns)]
        self.page_range.as_ref().and_then(|v| match v {
            crate::model::process_options::PageRange::FromEnd(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
    /// to hold a `FromEnd`.
    ///
    /// Note that all the setters affecting `page_range` are
    /// mutually exclusive.
    pub fn set_from_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_range =
            std::option::Option::Some(crate::model::process_options::PageRange::FromEnd(v.into()));
        self
    }
}

impl wkt::message::Message for ProcessOptions {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions"
    }
}

/// Defines additional types related to [ProcessOptions].
pub mod process_options {
    #[allow(unused_imports)]
    use super::*;

    /// Serving config for layout parser processor.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct LayoutConfig {
        /// Optional. Config for chunking in layout parser processor.
        pub chunking_config:
            std::option::Option<crate::model::process_options::layout_config::ChunkingConfig>,

        /// Optional. Whether to include images in layout parser processor response.
        pub return_images: bool,

        /// Optional. Whether to include bounding boxes in layout parser processor
        /// response.
        pub return_bounding_boxes: bool,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl LayoutConfig {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
        pub fn set_chunking_config<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
        {
            self.chunking_config = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
        pub fn set_or_clear_chunking_config<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
        {
            self.chunking_config = v.map(|x| x.into());
            self
        }

        /// Sets the value of [return_images][crate::model::process_options::LayoutConfig::return_images].
        pub fn set_return_images<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.return_images = v.into();
            self
        }

        /// Sets the value of [return_bounding_boxes][crate::model::process_options::LayoutConfig::return_bounding_boxes].
        pub fn set_return_bounding_boxes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.return_bounding_boxes = v.into();
            self
        }
    }

    impl wkt::message::Message for LayoutConfig {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig"
        }
    }

    /// Defines additional types related to [LayoutConfig].
    pub mod layout_config {
        #[allow(unused_imports)]
        use super::*;

        /// Serving config for chunking.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct ChunkingConfig {
            /// Optional. The chunk sizes to use when splitting documents, in order of
            /// level.
            pub chunk_size: i32,

            /// Optional. Whether or not to include ancestor headings when splitting.
            pub include_ancestor_headings: bool,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl ChunkingConfig {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [chunk_size][crate::model::process_options::layout_config::ChunkingConfig::chunk_size].
            pub fn set_chunk_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.chunk_size = v.into();
                self
            }

            /// Sets the value of [include_ancestor_headings][crate::model::process_options::layout_config::ChunkingConfig::include_ancestor_headings].
            pub fn set_include_ancestor_headings<T: std::convert::Into<bool>>(
                mut self,
                v: T,
            ) -> Self {
                self.include_ancestor_headings = v.into();
                self
            }
        }

        impl wkt::message::Message for ChunkingConfig {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig.ChunkingConfig"
            }
        }
    }

    /// A list of individual page numbers.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct IndividualPageSelector {
        /// Optional. Indices of the pages (starting from 1).
        pub pages: std::vec::Vec<i32>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl IndividualPageSelector {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [pages][crate::model::process_options::IndividualPageSelector::pages].
        pub fn set_pages<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<i32>,
        {
            use std::iter::Iterator;
            self.pages = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for IndividualPageSelector {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector"
        }
    }

    /// A subset of pages to process. If not specified, all pages are processed.
    /// If a page range is set, only the given pages are extracted and processed
    /// from the document. In the output document,
    /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
    /// refers to the page number in the original document.
    /// This configuration only applies to online processing with
    /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
    ///
    /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
    /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum PageRange {
        /// Which pages to process (1-indexed).
        IndividualPageSelector(
            std::boxed::Box<crate::model::process_options::IndividualPageSelector>,
        ),
        /// Only process certain pages from the start. Process all if the document
        /// has fewer pages.
        FromStart(i32),
        /// Only process certain pages from the end, same as above.
        FromEnd(i32),
    }
}

/// Request message for the
/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProcessRequest {
    /// Required. The resource name of the
    /// [Processor][google.cloud.documentai.v1.Processor] or
    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]
    /// to use for processing. If a
    /// [Processor][google.cloud.documentai.v1.Processor] is specified, the server
    /// will use its [default
    /// version][google.cloud.documentai.v1.Processor.default_processor_version].
    /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
    /// or
    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
    ///
    /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
    /// [google.cloud.documentai.v1.Processor.default_processor_version]: crate::model::Processor::default_processor_version
    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
    pub name: std::string::String,

    /// Whether human review should be skipped for this request. Default to
    /// `false`.
    pub skip_human_review: bool,

    /// Specifies which fields to include in the
    /// [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document]
    /// output. Only supports top-level document and pages field, so it must be in
    /// the form of `{document_field_name}` or `pages.{page_field_name}`.
    ///
    /// [google.cloud.documentai.v1.ProcessResponse.document]: crate::model::ProcessResponse::document
    pub field_mask: std::option::Option<wkt::FieldMask>,

    /// Inference-time options for the process API
    pub process_options: std::option::Option<crate::model::ProcessOptions>,

    /// Optional. The labels with user-defined metadata for the request.
    ///
    /// Label keys and values can be no longer than 63 characters
    /// (Unicode codepoints) and can only contain lowercase letters, numeric
    /// characters, underscores, and dashes. International characters are allowed.
    /// Label values are optional. Label keys must start with a letter.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. Option to remove images from the document.
    pub imageless_mode: bool,

    /// The document payload.
    pub source: std::option::Option<crate::model::process_request::Source>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ProcessRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ProcessRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [skip_human_review][crate::model::ProcessRequest::skip_human_review].
    pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.skip_human_review = v.into();
        self
    }

    /// Sets the value of [field_mask][crate::model::ProcessRequest::field_mask].
    pub fn set_field_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.field_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [field_mask][crate::model::ProcessRequest::field_mask].
    pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.field_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [process_options][crate::model::ProcessRequest::process_options].
    pub fn set_process_options<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ProcessOptions>,
    {
        self.process_options = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [process_options][crate::model::ProcessRequest::process_options].
    pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ProcessOptions>,
    {
        self.process_options = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::ProcessRequest::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [imageless_mode][crate::model::ProcessRequest::imageless_mode].
    pub fn set_imageless_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.imageless_mode = v.into();
        self
    }

    /// Sets the value of [source][crate::model::ProcessRequest::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<
        T: std::convert::Into<std::option::Option<crate::model::process_request::Source>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::ProcessRequest::source]
    /// if it holds a `InlineDocument`, `None` if the field is not set or
    /// holds a different branch.
    pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::process_request::Source::InlineDocument(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::ProcessRequest::source]
    /// to hold a `InlineDocument`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::process_request::Source::InlineDocument(v.into()),
        );
        self
    }

    /// The value of [source][crate::model::ProcessRequest::source]
    /// if it holds a `RawDocument`, `None` if the field is not set or
    /// holds a different branch.
    pub fn raw_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::RawDocument>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::process_request::Source::RawDocument(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::ProcessRequest::source]
    /// to hold a `RawDocument`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_raw_document<T: std::convert::Into<std::boxed::Box<crate::model::RawDocument>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source =
            std::option::Option::Some(crate::model::process_request::Source::RawDocument(v.into()));
        self
    }

    /// The value of [source][crate::model::ProcessRequest::source]
    /// if it holds a `GcsDocument`, `None` if the field is not set or
    /// holds a different branch.
    pub fn gcs_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocument>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::process_request::Source::GcsDocument(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::ProcessRequest::source]
    /// to hold a `GcsDocument`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_gcs_document<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocument>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source =
            std::option::Option::Some(crate::model::process_request::Source::GcsDocument(v.into()));
        self
    }
}

impl wkt::message::Message for ProcessRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ProcessRequest"
    }
}

/// Defines additional types related to [ProcessRequest].
pub mod process_request {
    #[allow(unused_imports)]
    use super::*;

    /// The document payload.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// An inline document proto.
        InlineDocument(std::boxed::Box<crate::model::Document>),
        /// A raw document content (bytes).
        RawDocument(std::boxed::Box<crate::model::RawDocument>),
        /// A raw document on Google Cloud Storage.
        GcsDocument(std::boxed::Box<crate::model::GcsDocument>),
    }
}

/// The status of human review on a processed document.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HumanReviewStatus {
    /// The state of human review on the processing request.
    pub state: crate::model::human_review_status::State,

    /// A message providing more details about the human review state.
    pub state_message: std::string::String,

    /// The name of the operation triggered by the processed document. This field
    /// is populated only when the
    /// [state][google.cloud.documentai.v1.HumanReviewStatus.state] is
    /// `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as
    /// the long-running operation returned by
    /// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument].
    ///
    /// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
    /// [google.cloud.documentai.v1.HumanReviewStatus.state]: crate::model::HumanReviewStatus::state
    pub human_review_operation: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl HumanReviewStatus {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [state][crate::model::HumanReviewStatus::state].
    pub fn set_state<T: std::convert::Into<crate::model::human_review_status::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_message][crate::model::HumanReviewStatus::state_message].
    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_message = v.into();
        self
    }

    /// Sets the value of [human_review_operation][crate::model::HumanReviewStatus::human_review_operation].
    pub fn set_human_review_operation<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.human_review_operation = v.into();
        self
    }
}

impl wkt::message::Message for HumanReviewStatus {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.HumanReviewStatus"
    }
}

/// Defines additional types related to [HumanReviewStatus].
pub mod human_review_status {
    #[allow(unused_imports)]
    use super::*;

    /// The final state of human review on a processed document.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Human review state is unspecified. Most likely due to an internal error.
        Unspecified,
        /// Human review is skipped for the document. This can happen because human
        /// review isn't enabled on the processor or the processing request has
        /// been set to skip this document.
        Skipped,
        /// Human review validation is triggered and passed, so no review is needed.
        ValidationPassed,
        /// Human review validation is triggered and the document is under review.
        InProgress,
        /// Some error happened during triggering human review, see the
        /// [state_message][google.cloud.documentai.v1.HumanReviewStatus.state_message]
        /// for details.
        ///
        /// [google.cloud.documentai.v1.HumanReviewStatus.state_message]: crate::model::HumanReviewStatus::state_message
        Error,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Skipped => std::option::Option::Some(1),
                Self::ValidationPassed => std::option::Option::Some(2),
                Self::InProgress => std::option::Option::Some(3),
                Self::Error => std::option::Option::Some(4),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Skipped => std::option::Option::Some("SKIPPED"),
                Self::ValidationPassed => std::option::Option::Some("VALIDATION_PASSED"),
                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
                Self::Error => std::option::Option::Some("ERROR"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Skipped,
                2 => Self::ValidationPassed,
                3 => Self::InProgress,
                4 => Self::Error,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "SKIPPED" => Self::Skipped,
                "VALIDATION_PASSED" => Self::ValidationPassed,
                "IN_PROGRESS" => Self::InProgress,
                "ERROR" => Self::Error,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Skipped => serializer.serialize_i32(1),
                Self::ValidationPassed => serializer.serialize_i32(2),
                Self::InProgress => serializer.serialize_i32(3),
                Self::Error => serializer.serialize_i32(4),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.documentai.v1.HumanReviewStatus.State",
            ))
        }
    }
}

/// Response message for the
/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProcessResponse {
    /// The document payload, will populate fields based on the processor's
    /// behavior.
    pub document: std::option::Option<crate::model::Document>,

    /// The status of human review on the processed document.
    pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ProcessResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [document][crate::model::ProcessResponse::document].
    pub fn set_document<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Document>,
    {
        self.document = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [document][crate::model::ProcessResponse::document].
    pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Document>,
    {
        self.document = v.map(|x| x.into());
        self
    }

    /// Sets the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
    pub fn set_human_review_status<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::HumanReviewStatus>,
    {
        self.human_review_status = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
    pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::HumanReviewStatus>,
    {
        self.human_review_status = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ProcessResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ProcessResponse"
    }
}

/// Request message for
/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
///
/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchProcessRequest {
    /// Required. The resource name of
    /// [Processor][google.cloud.documentai.v1.Processor] or
    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
    /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
    /// or
    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
    ///
    /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
    pub name: std::string::String,

    /// The input documents for the
    /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
    /// method.
    ///
    /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
    pub input_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,

    /// The output configuration for the
    /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
    /// method.
    ///
    /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
    pub document_output_config: std::option::Option<crate::model::DocumentOutputConfig>,

    /// Whether human review should be skipped for this request. Default to
    /// `false`.
    pub skip_human_review: bool,

    /// Inference-time options for the process API
    pub process_options: std::option::Option<crate::model::ProcessOptions>,

    /// Optional. The labels with user-defined metadata for the request.
    ///
    /// Label keys and values can be no longer than 63 characters
    /// (Unicode codepoints) and can only contain lowercase letters, numeric
    /// characters, underscores, and dashes. International characters are allowed.
    /// Label values are optional. Label keys must start with a letter.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BatchProcessRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::BatchProcessRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
    pub fn set_input_documents<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
    {
        self.input_documents = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
    pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
    {
        self.input_documents = v.map(|x| x.into());
        self
    }

    /// Sets the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
    pub fn set_document_output_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DocumentOutputConfig>,
    {
        self.document_output_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
    pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DocumentOutputConfig>,
    {
        self.document_output_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [skip_human_review][crate::model::BatchProcessRequest::skip_human_review].
    pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.skip_human_review = v.into();
        self
    }

    /// Sets the value of [process_options][crate::model::BatchProcessRequest::process_options].
    pub fn set_process_options<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ProcessOptions>,
    {
        self.process_options = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [process_options][crate::model::BatchProcessRequest::process_options].
    pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ProcessOptions>,
    {
        self.process_options = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::BatchProcessRequest::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for BatchProcessRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.BatchProcessRequest"
    }
}

/// Response message for
/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
///
/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchProcessResponse {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BatchProcessResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for BatchProcessResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.BatchProcessResponse"
    }
}

/// The long-running operation metadata for
/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
///
/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchProcessMetadata {
    /// The state of the current batch processing.
    pub state: crate::model::batch_process_metadata::State,

    /// A message providing more details about the current state of processing.
    /// For example, the error message if the operation is failed.
    pub state_message: std::string::String,

    /// The creation time of the operation.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// The last update time of the operation.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// The list of response details of each document.
    pub individual_process_statuses:
        std::vec::Vec<crate::model::batch_process_metadata::IndividualProcessStatus>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BatchProcessMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [state][crate::model::BatchProcessMetadata::state].
    pub fn set_state<T: std::convert::Into<crate::model::batch_process_metadata::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_message][crate::model::BatchProcessMetadata::state_message].
    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_message = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::BatchProcessMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::BatchProcessMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::BatchProcessMetadata::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::BatchProcessMetadata::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [individual_process_statuses][crate::model::BatchProcessMetadata::individual_process_statuses].
    pub fn set_individual_process_statuses<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::batch_process_metadata::IndividualProcessStatus>,
    {
        use std::iter::Iterator;
        self.individual_process_statuses = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for BatchProcessMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata"
    }
}

/// Defines additional types related to [BatchProcessMetadata].
pub mod batch_process_metadata {
    #[allow(unused_imports)]
    use super::*;

    /// The status of a each individual document in the batch process.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct IndividualProcessStatus {
        /// The source of the document, same as the
        /// [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]
        /// field in the request when the batch process started.
        ///
        /// [google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]: crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source
        pub input_gcs_source: std::string::String,

        /// The status processing the document.
        pub status: std::option::Option<rpc::model::Status>,

        /// The Cloud Storage output destination (in the request as
        /// [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri])
        /// of the processed document if it was successful, otherwise empty.
        ///
        /// [google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]: crate::model::document_output_config::GcsOutputConfig::gcs_uri
        pub output_gcs_destination: std::string::String,

        /// The status of human review on the processed document.
        pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl IndividualProcessStatus {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [input_gcs_source][crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source].
        pub fn set_input_gcs_source<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.input_gcs_source = v.into();
            self
        }

        /// Sets the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
        pub fn set_status<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<rpc::model::Status>,
        {
            self.status = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
        pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<rpc::model::Status>,
        {
            self.status = v.map(|x| x.into());
            self
        }

        /// Sets the value of [output_gcs_destination][crate::model::batch_process_metadata::IndividualProcessStatus::output_gcs_destination].
        pub fn set_output_gcs_destination<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.output_gcs_destination = v.into();
            self
        }

        /// Sets the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
        pub fn set_human_review_status<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::HumanReviewStatus>,
        {
            self.human_review_status = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
        pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::HumanReviewStatus>,
        {
            self.human_review_status = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for IndividualProcessStatus {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus"
        }
    }

    /// Possible states of the batch processing operation.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The default value. This value is used if the state is omitted.
        Unspecified,
        /// Request operation is waiting for scheduling.
        Waiting,
        /// Request is being processed.
        Running,
        /// The batch processing completed successfully.
        Succeeded,
        /// The batch processing was being cancelled.
        Cancelling,
        /// The batch processing was cancelled.
        Cancelled,
        /// The batch processing has failed.
        Failed,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Waiting => std::option::Option::Some(1),
                Self::Running => std::option::Option::Some(2),
                Self::Succeeded => std::option::Option::Some(3),
                Self::Cancelling => std::option::Option::Some(4),
                Self::Cancelled => std::option::Option::Some(5),
                Self::Failed => std::option::Option::Some(6),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Waiting => std::option::Option::Some("WAITING"),
                Self::Running => std::option::Option::Some("RUNNING"),
                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
                Self::Cancelling => std::option::Option::Some("CANCELLING"),
                Self::Cancelled => std::option::Option::Some("CANCELLED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Waiting,
                2 => Self::Running,
                3 => Self::Succeeded,
                4 => Self::Cancelling,
                5 => Self::Cancelled,
                6 => Self::Failed,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "WAITING" => Self::Waiting,
                "RUNNING" => Self::Running,
                "SUCCEEDED" => Self::Succeeded,
                "CANCELLING" => Self::Cancelling,
                "CANCELLED" => Self::Cancelled,
                "FAILED" => Self::Failed,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Waiting => serializer.serialize_i32(1),
                Self::Running => serializer.serialize_i32(2),
                Self::Succeeded => serializer.serialize_i32(3),
                Self::Cancelling => serializer.serialize_i32(4),
                Self::Cancelled => serializer.serialize_i32(5),
                Self::Failed => serializer.serialize_i32(6),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.documentai.v1.BatchProcessMetadata.State",
            ))
        }
    }
}

/// Request message for the
/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
/// method. Some processor types may require the project be added to an
/// allowlist.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FetchProcessorTypesRequest {
    /// Required. The location of processor types to list.
    /// Format: `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl FetchProcessorTypesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::FetchProcessorTypesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }
}

impl wkt::message::Message for FetchProcessorTypesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesRequest"
    }
}

/// Response message for the
/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FetchProcessorTypesResponse {
    /// The list of processor types.
    pub processor_types: std::vec::Vec<crate::model::ProcessorType>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl FetchProcessorTypesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [processor_types][crate::model::FetchProcessorTypesResponse::processor_types].
    pub fn set_processor_types<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ProcessorType>,
    {
        use std::iter::Iterator;
        self.processor_types = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for FetchProcessorTypesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesResponse"
    }
}

/// Request message for the
/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
/// method. Some processor types may require the project be added to an
/// allowlist.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProcessorTypesRequest {
    /// Required. The location of processor types to list.
    /// Format: `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// The maximum number of processor types to return.
    /// If unspecified, at most `100` processor types will be returned.
    /// The maximum value is `500`. Values above `500` will be coerced to `500`.
    pub page_size: i32,

    /// Used to retrieve the next page of results, empty if at the end of the list.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProcessorTypesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListProcessorTypesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListProcessorTypesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListProcessorTypesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListProcessorTypesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesRequest"
    }
}

/// Response message for the
/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProcessorTypesResponse {
    /// The processor types.
    pub processor_types: std::vec::Vec<crate::model::ProcessorType>,

    /// Points to the next page, otherwise empty.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProcessorTypesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [processor_types][crate::model::ListProcessorTypesResponse::processor_types].
    pub fn set_processor_types<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ProcessorType>,
    {
        use std::iter::Iterator;
        self.processor_types = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListProcessorTypesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListProcessorTypesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListProcessorTypesResponse {
    type PageItem = crate::model::ProcessorType;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.processor_types
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for list all processors belongs to a project.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProcessorsRequest {
    /// Required. The parent (project and location) which owns this collection of
    /// Processors. Format: `projects/{project}/locations/{location}`
    pub parent: std::string::String,

    /// The maximum number of processors to return.
    /// If unspecified, at most `50` processors will be returned.
    /// The maximum value is `100`. Values above `100` will be coerced to `100`.
    pub page_size: i32,

    /// We will return the processors sorted by creation time. The page token
    /// will point to the next processor.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProcessorsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListProcessorsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListProcessorsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListProcessorsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListProcessorsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsRequest"
    }
}

/// Response message for the
/// [ListProcessors][google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]: crate::client::DocumentProcessorService::list_processors
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProcessorsResponse {
    /// The list of processors.
    pub processors: std::vec::Vec<crate::model::Processor>,

    /// Points to the next processor, otherwise empty.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProcessorsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [processors][crate::model::ListProcessorsResponse::processors].
    pub fn set_processors<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Processor>,
    {
        use std::iter::Iterator;
        self.processors = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListProcessorsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListProcessorsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListProcessorsResponse {
    type PageItem = crate::model::Processor;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.processors
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for the
/// [GetProcessorType][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]: crate::client::DocumentProcessorService::get_processor_type
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetProcessorTypeRequest {
    /// Required. The processor type resource name.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetProcessorTypeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetProcessorTypeRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetProcessorTypeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.GetProcessorTypeRequest"
    }
}

/// Request message for the
/// [GetProcessor][google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]: crate::client::DocumentProcessorService::get_processor
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetProcessorRequest {
    /// Required. The processor resource name.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetProcessorRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetProcessorRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetProcessorRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.GetProcessorRequest"
    }
}

/// Request message for the
/// [GetProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]: crate::client::DocumentProcessorService::get_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetProcessorVersionRequest {
    /// Required. The processor resource name.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetProcessorVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetProcessorVersionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetProcessorVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.GetProcessorVersionRequest"
    }
}

/// Request message for list all processor versions belongs to a processor.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProcessorVersionsRequest {
    /// Required. The parent (project, location and processor) to list all
    /// versions. Format:
    /// `projects/{project}/locations/{location}/processors/{processor}`
    pub parent: std::string::String,

    /// The maximum number of processor versions to return.
    /// If unspecified, at most `10` processor versions will be returned.
    /// The maximum value is `20`. Values above `20` will be coerced to `20`.
    pub page_size: i32,

    /// We will return the processor versions sorted by creation time. The page
    /// token will point to the next processor version.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProcessorVersionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListProcessorVersionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListProcessorVersionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListProcessorVersionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListProcessorVersionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsRequest"
    }
}

/// Response message for the
/// [ListProcessorVersions][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]: crate::client::DocumentProcessorService::list_processor_versions
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProcessorVersionsResponse {
    /// The list of processors.
    pub processor_versions: std::vec::Vec<crate::model::ProcessorVersion>,

    /// Points to the next processor, otherwise empty.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProcessorVersionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [processor_versions][crate::model::ListProcessorVersionsResponse::processor_versions].
    pub fn set_processor_versions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ProcessorVersion>,
    {
        use std::iter::Iterator;
        self.processor_versions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListProcessorVersionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListProcessorVersionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListProcessorVersionsResponse {
    type PageItem = crate::model::ProcessorVersion;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.processor_versions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for the
/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteProcessorVersionRequest {
    /// Required. The processor version resource name to be deleted.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteProcessorVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteProcessorVersionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteProcessorVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionRequest"
    }
}

/// The long-running operation metadata for the
/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteProcessorVersionMetadata {
    /// The basic metadata of the long-running operation.
    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteProcessorVersionMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
    pub fn set_common_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for DeleteProcessorVersionMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionMetadata"
    }
}

/// Request message for the
/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeployProcessorVersionRequest {
    /// Required. The processor version resource name to be deployed.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeployProcessorVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeployProcessorVersionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeployProcessorVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionRequest"
    }
}

/// Response message for the
/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeployProcessorVersionResponse {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeployProcessorVersionResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for DeployProcessorVersionResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionResponse"
    }
}

/// The long-running operation metadata for the
/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeployProcessorVersionMetadata {
    /// The basic metadata of the long-running operation.
    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeployProcessorVersionMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
    pub fn set_common_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for DeployProcessorVersionMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionMetadata"
    }
}

/// Request message for the
/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeployProcessorVersionRequest {
    /// Required. The processor version resource name to be undeployed.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UndeployProcessorVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::UndeployProcessorVersionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for UndeployProcessorVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionRequest"
    }
}

/// Response message for the
/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeployProcessorVersionResponse {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UndeployProcessorVersionResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for UndeployProcessorVersionResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionResponse"
    }
}

/// The long-running operation metadata for the
/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeployProcessorVersionMetadata {
    /// The basic metadata of the long-running operation.
    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UndeployProcessorVersionMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
    pub fn set_common_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UndeployProcessorVersionMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionMetadata"
    }
}

/// Request message for the
/// [CreateProcessor][google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]
/// method. Notice this request is sent to a regionalized backend service. If the
/// [ProcessorType][google.cloud.documentai.v1.ProcessorType] isn't available in
/// that region, the creation fails.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]: crate::client::DocumentProcessorService::create_processor
/// [google.cloud.documentai.v1.ProcessorType]: crate::model::ProcessorType
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateProcessorRequest {
    /// Required. The parent (project and location) under which to create the
    /// processor. Format: `projects/{project}/locations/{location}`
    pub parent: std::string::String,

    /// Required. The processor to be created, requires
    /// [Processor.type][google.cloud.documentai.v1.Processor.type] and
    /// [Processor.display_name][google.cloud.documentai.v1.Processor.display_name]
    /// to be set. Also, the
    /// [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name]
    /// field must be set if the processor is under CMEK.
    ///
    /// [google.cloud.documentai.v1.Processor.display_name]: crate::model::Processor::display_name
    /// [google.cloud.documentai.v1.Processor.kms_key_name]: crate::model::Processor::kms_key_name
    /// [google.cloud.documentai.v1.Processor.type]: crate::model::Processor::type
    pub processor: std::option::Option<crate::model::Processor>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateProcessorRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateProcessorRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [processor][crate::model::CreateProcessorRequest::processor].
    pub fn set_processor<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Processor>,
    {
        self.processor = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [processor][crate::model::CreateProcessorRequest::processor].
    pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Processor>,
    {
        self.processor = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateProcessorRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.CreateProcessorRequest"
    }
}

/// Request message for the
/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteProcessorRequest {
    /// Required. The processor resource name to be deleted.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteProcessorRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteProcessorRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteProcessorRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorRequest"
    }
}

/// The long-running operation metadata for the
/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteProcessorMetadata {
    /// The basic metadata of the long-running operation.
    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteProcessorMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
    pub fn set_common_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for DeleteProcessorMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorMetadata"
    }
}

/// Request message for the
/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EnableProcessorRequest {
    /// Required. The processor resource name to be enabled.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EnableProcessorRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::EnableProcessorRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for EnableProcessorRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorRequest"
    }
}

/// Response message for the
/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
/// method. Intentionally empty proto for adding fields in future.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EnableProcessorResponse {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EnableProcessorResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for EnableProcessorResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorResponse"
    }
}

/// The long-running operation metadata for the
/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EnableProcessorMetadata {
    /// The basic metadata of the long-running operation.
    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EnableProcessorMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
    pub fn set_common_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for EnableProcessorMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorMetadata"
    }
}

/// Request message for the
/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DisableProcessorRequest {
    /// Required. The processor resource name to be disabled.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DisableProcessorRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DisableProcessorRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DisableProcessorRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorRequest"
    }
}

/// Response message for the
/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
/// method. Intentionally empty proto for adding fields in future.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DisableProcessorResponse {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DisableProcessorResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for DisableProcessorResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorResponse"
    }
}

/// The long-running operation metadata for the
/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DisableProcessorMetadata {
    /// The basic metadata of the long-running operation.
    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DisableProcessorMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
    pub fn set_common_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for DisableProcessorMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorMetadata"
    }
}

/// Request message for the
/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SetDefaultProcessorVersionRequest {
    /// Required. The resource name of the
    /// [Processor][google.cloud.documentai.v1.Processor] to change default
    /// version.
    ///
    /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
    pub processor: std::string::String,

    /// Required. The resource name of child
    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as
    /// default. Format:
    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
    ///
    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
    pub default_processor_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SetDefaultProcessorVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [processor][crate::model::SetDefaultProcessorVersionRequest::processor].
    pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.processor = v.into();
        self
    }

    /// Sets the value of [default_processor_version][crate::model::SetDefaultProcessorVersionRequest::default_processor_version].
    pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.default_processor_version = v.into();
        self
    }
}

impl wkt::message::Message for SetDefaultProcessorVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionRequest"
    }
}

/// Response message for the
/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SetDefaultProcessorVersionResponse {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SetDefaultProcessorVersionResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for SetDefaultProcessorVersionResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionResponse"
    }
}

/// The long-running operation metadata for the
/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SetDefaultProcessorVersionMetadata {
    /// The basic metadata of the long-running operation.
    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SetDefaultProcessorVersionMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
    pub fn set_common_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for SetDefaultProcessorVersionMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata"
    }
}

/// Request message for the
/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TrainProcessorVersionRequest {
    /// Required. The parent (project, location and processor) to create the new
    /// version for. Format:
    /// `projects/{project}/locations/{location}/processors/{processor}`.
    pub parent: std::string::String,

    /// Required. The processor version to be created.
    pub processor_version: std::option::Option<crate::model::ProcessorVersion>,

    /// Optional. The schema the processor version will be trained with.
    pub document_schema: std::option::Option<crate::model::DocumentSchema>,

    /// Optional. The input data used to train the
    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
    ///
    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
    pub input_data: std::option::Option<crate::model::train_processor_version_request::InputData>,

    /// Optional. The processor version to use as a base for training. This
    /// processor version must be a child of `parent`. Format:
    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
    pub base_processor_version: std::string::String,

    pub processor_flags:
        std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TrainProcessorVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::TrainProcessorVersionRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
    pub fn set_processor_version<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ProcessorVersion>,
    {
        self.processor_version = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
    pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ProcessorVersion>,
    {
        self.processor_version = v.map(|x| x.into());
        self
    }

    /// Sets the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
    pub fn set_document_schema<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DocumentSchema>,
    {
        self.document_schema = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
    pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DocumentSchema>,
    {
        self.document_schema = v.map(|x| x.into());
        self
    }

    /// Sets the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
    pub fn set_input_data<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
    {
        self.input_data = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
    pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
    {
        self.input_data = v.map(|x| x.into());
        self
    }

    /// Sets the value of [base_processor_version][crate::model::TrainProcessorVersionRequest::base_processor_version].
    pub fn set_base_processor_version<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.base_processor_version = v.into();
        self
    }

    /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags].
    ///
    /// Note that all the setters affecting `processor_flags` are mutually
    /// exclusive.
    pub fn set_processor_flags<
        T: std::convert::Into<
                std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.processor_flags = v.into();
        self
    }

    /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
    /// if it holds a `CustomDocumentExtractionOptions`, `None` if the field is not set or
    /// holds a different branch.
    pub fn custom_document_extraction_options(
        &self,
    ) -> std::option::Option<
        &std::boxed::Box<
            crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
        >,
    > {
        #[allow(unreachable_patterns)]
        self.processor_flags.as_ref().and_then(|v| match v {
            crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
    /// to hold a `CustomDocumentExtractionOptions`.
    ///
    /// Note that all the setters affecting `processor_flags` are
    /// mutually exclusive.
    pub fn set_custom_document_extraction_options<
        T: std::convert::Into<
                std::boxed::Box<
                    crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
                >,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.processor_flags = std::option::Option::Some(
            crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(
                v.into()
            )
        );
        self
    }

    /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
    /// if it holds a `FoundationModelTuningOptions`, `None` if the field is not set or
    /// holds a different branch.
    pub fn foundation_model_tuning_options(
        &self,
    ) -> std::option::Option<
        &std::boxed::Box<
            crate::model::train_processor_version_request::FoundationModelTuningOptions,
        >,
    > {
        #[allow(unreachable_patterns)]
        self.processor_flags.as_ref().and_then(|v| match v {
            crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
    /// to hold a `FoundationModelTuningOptions`.
    ///
    /// Note that all the setters affecting `processor_flags` are
    /// mutually exclusive.
    pub fn set_foundation_model_tuning_options<
        T: std::convert::Into<
                std::boxed::Box<
                    crate::model::train_processor_version_request::FoundationModelTuningOptions,
                >,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.processor_flags = std::option::Option::Some(
            crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(
                v.into()
            )
        );
        self
    }
}

impl wkt::message::Message for TrainProcessorVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest"
    }
}

/// Defines additional types related to [TrainProcessorVersionRequest].
pub mod train_processor_version_request {
    #[allow(unused_imports)]
    use super::*;

    /// The input data used to train a new
    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
    ///
    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct InputData {
        /// The documents used for training the new version.
        pub training_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,

        /// The documents used for testing the trained version.
        pub test_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl InputData {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
        pub fn set_training_documents<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
        {
            self.training_documents = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
        pub fn set_or_clear_training_documents<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
        {
            self.training_documents = v.map(|x| x.into());
            self
        }

        /// Sets the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
        pub fn set_test_documents<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
        {
            self.test_documents = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
        pub fn set_or_clear_test_documents<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
        {
            self.test_documents = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for InputData {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData"
        }
    }

    /// Options to control the training of the Custom Document Extraction (CDE)
    /// Processor.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct CustomDocumentExtractionOptions {

        /// Optional. Training method to use for CDE training.
        pub training_method: crate::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl CustomDocumentExtractionOptions {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [training_method][crate::model::train_processor_version_request::CustomDocumentExtractionOptions::training_method].
        pub fn set_training_method<T: std::convert::Into<crate::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod>>(mut self, v: T) -> Self{
            self.training_method = v.into();
            self
        }
    }

    impl wkt::message::Message for CustomDocumentExtractionOptions {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions"
        }
    }

    /// Defines additional types related to [CustomDocumentExtractionOptions].
    pub mod custom_document_extraction_options {
        #[allow(unused_imports)]
        use super::*;

        /// Training Method for CDE. `TRAINING_METHOD_UNSPECIFIED` will fall back to
        /// `MODEL_BASED`.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum TrainingMethod {
            Unspecified,
            ModelBased,
            TemplateBased,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [TrainingMethod::value] or
            /// [TrainingMethod::name].
            UnknownValue(training_method::UnknownValue),
        }

        #[doc(hidden)]
        pub mod training_method {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl TrainingMethod {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::ModelBased => std::option::Option::Some(1),
                    Self::TemplateBased => std::option::Option::Some(2),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("TRAINING_METHOD_UNSPECIFIED"),
                    Self::ModelBased => std::option::Option::Some("MODEL_BASED"),
                    Self::TemplateBased => std::option::Option::Some("TEMPLATE_BASED"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for TrainingMethod {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for TrainingMethod {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for TrainingMethod {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::ModelBased,
                    2 => Self::TemplateBased,
                    _ => Self::UnknownValue(training_method::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for TrainingMethod {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "TRAINING_METHOD_UNSPECIFIED" => Self::Unspecified,
                    "MODEL_BASED" => Self::ModelBased,
                    "TEMPLATE_BASED" => Self::TemplateBased,
                    _ => Self::UnknownValue(training_method::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for TrainingMethod {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::ModelBased => serializer.serialize_i32(1),
                    Self::TemplateBased => serializer.serialize_i32(2),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for TrainingMethod {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingMethod>::new(
                    ".google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod"))
            }
        }
    }

    /// Options to control foundation model tuning of the processor.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct FoundationModelTuningOptions {
        /// Optional. The number of steps to run for model tuning. Valid values are
        /// between 1 and 400. If not provided, recommended steps will be used.
        pub train_steps: i32,

        /// Optional. The multiplier to apply to the recommended learning rate. Valid
        /// values are between 0.1 and 10. If not provided, recommended learning rate
        /// will be used.
        pub learning_rate_multiplier: f32,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl FoundationModelTuningOptions {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [train_steps][crate::model::train_processor_version_request::FoundationModelTuningOptions::train_steps].
        pub fn set_train_steps<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.train_steps = v.into();
            self
        }

        /// Sets the value of [learning_rate_multiplier][crate::model::train_processor_version_request::FoundationModelTuningOptions::learning_rate_multiplier].
        pub fn set_learning_rate_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
            self.learning_rate_multiplier = v.into();
            self
        }
    }

    impl wkt::message::Message for FoundationModelTuningOptions {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.FoundationModelTuningOptions"
        }
    }

    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ProcessorFlags {
        /// Options to control Custom Document Extraction (CDE) Processor.
        CustomDocumentExtractionOptions(
            std::boxed::Box<
                crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
            >,
        ),
        /// Options to control foundation model tuning of a processor.
        FoundationModelTuningOptions(
            std::boxed::Box<
                crate::model::train_processor_version_request::FoundationModelTuningOptions,
            >,
        ),
    }
}

/// The response for
/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion].
///
/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TrainProcessorVersionResponse {
    /// The resource name of the processor version produced by training.
    pub processor_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TrainProcessorVersionResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [processor_version][crate::model::TrainProcessorVersionResponse::processor_version].
    pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.processor_version = v.into();
        self
    }
}

impl wkt::message::Message for TrainProcessorVersionResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionResponse"
    }
}

/// The metadata that represents a processor version being created.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TrainProcessorVersionMetadata {
    /// The basic metadata of the long-running operation.
    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,

    /// The training dataset validation information.
    pub training_dataset_validation:
        std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,

    /// The test dataset validation information.
    pub test_dataset_validation:
        std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TrainProcessorVersionMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
    pub fn set_common_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = v.map(|x| x.into());
        self
    }

    /// Sets the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
    pub fn set_training_dataset_validation<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
    {
        self.training_dataset_validation = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
    pub fn set_or_clear_training_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
    {
        self.training_dataset_validation = v.map(|x| x.into());
        self
    }

    /// Sets the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
    pub fn set_test_dataset_validation<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
    {
        self.test_dataset_validation = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
    pub fn set_or_clear_test_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
    {
        self.test_dataset_validation = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for TrainProcessorVersionMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata"
    }
}

/// Defines additional types related to [TrainProcessorVersionMetadata].
pub mod train_processor_version_metadata {
    #[allow(unused_imports)]
    use super::*;

    /// The dataset validation information.
    /// This includes any and all errors with documents and the dataset.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct DatasetValidation {
        /// The total number of document errors.
        pub document_error_count: i32,

        /// The total number of dataset errors.
        pub dataset_error_count: i32,

        /// Error information pertaining to specific documents. A maximum of 10
        /// document errors will be returned.
        /// Any document with errors will not be used throughout training.
        pub document_errors: std::vec::Vec<rpc::model::Status>,

        /// Error information for the dataset as a whole. A maximum of 10 dataset
        /// errors will be returned.
        /// A single dataset error is terminal for training.
        pub dataset_errors: std::vec::Vec<rpc::model::Status>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl DatasetValidation {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [document_error_count][crate::model::train_processor_version_metadata::DatasetValidation::document_error_count].
        pub fn set_document_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.document_error_count = v.into();
            self
        }

        /// Sets the value of [dataset_error_count][crate::model::train_processor_version_metadata::DatasetValidation::dataset_error_count].
        pub fn set_dataset_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.dataset_error_count = v.into();
            self
        }

        /// Sets the value of [document_errors][crate::model::train_processor_version_metadata::DatasetValidation::document_errors].
        pub fn set_document_errors<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<rpc::model::Status>,
        {
            use std::iter::Iterator;
            self.document_errors = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [dataset_errors][crate::model::train_processor_version_metadata::DatasetValidation::dataset_errors].
        pub fn set_dataset_errors<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<rpc::model::Status>,
        {
            use std::iter::Iterator;
            self.dataset_errors = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for DatasetValidation {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation"
        }
    }
}

/// Request message for the
/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReviewDocumentRequest {
    /// Required. The resource name of the
    /// [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the
    /// document will be reviewed with.
    pub human_review_config: std::string::String,

    /// Whether the validation should be performed on the ad-hoc review request.
    pub enable_schema_validation: bool,

    /// The priority of the human review task.
    pub priority: crate::model::review_document_request::Priority,

    /// The document schema of the human review task.
    pub document_schema: std::option::Option<crate::model::DocumentSchema>,

    /// The document payload.
    pub source: std::option::Option<crate::model::review_document_request::Source>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ReviewDocumentRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [human_review_config][crate::model::ReviewDocumentRequest::human_review_config].
    pub fn set_human_review_config<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.human_review_config = v.into();
        self
    }

    /// Sets the value of [enable_schema_validation][crate::model::ReviewDocumentRequest::enable_schema_validation].
    pub fn set_enable_schema_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enable_schema_validation = v.into();
        self
    }

    /// Sets the value of [priority][crate::model::ReviewDocumentRequest::priority].
    pub fn set_priority<T: std::convert::Into<crate::model::review_document_request::Priority>>(
        mut self,
        v: T,
    ) -> Self {
        self.priority = v.into();
        self
    }

    /// Sets the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
    pub fn set_document_schema<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DocumentSchema>,
    {
        self.document_schema = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
    pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DocumentSchema>,
    {
        self.document_schema = v.map(|x| x.into());
        self
    }

    /// Sets the value of [source][crate::model::ReviewDocumentRequest::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<
        T: std::convert::Into<std::option::Option<crate::model::review_document_request::Source>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::ReviewDocumentRequest::source]
    /// if it holds a `InlineDocument`, `None` if the field is not set or
    /// holds a different branch.
    pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::review_document_request::Source::InlineDocument(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::ReviewDocumentRequest::source]
    /// to hold a `InlineDocument`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::review_document_request::Source::InlineDocument(v.into()),
        );
        self
    }
}

impl wkt::message::Message for ReviewDocumentRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentRequest"
    }
}

/// Defines additional types related to [ReviewDocumentRequest].
pub mod review_document_request {
    #[allow(unused_imports)]
    use super::*;

    /// The priority level of the human review task.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Priority {
        /// The default priority level.
        Default,
        /// The urgent priority level. The labeling manager should allocate labeler
        /// resource to the urgent task queue to respect this priority level.
        Urgent,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Priority::value] or
        /// [Priority::name].
        UnknownValue(priority::UnknownValue),
    }

    #[doc(hidden)]
    pub mod priority {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Priority {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Default => std::option::Option::Some(0),
                Self::Urgent => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Default => std::option::Option::Some("DEFAULT"),
                Self::Urgent => std::option::Option::Some("URGENT"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Priority {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Priority {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Priority {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Default,
                1 => Self::Urgent,
                _ => Self::UnknownValue(priority::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Priority {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "DEFAULT" => Self::Default,
                "URGENT" => Self::Urgent,
                _ => Self::UnknownValue(priority::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Priority {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Default => serializer.serialize_i32(0),
                Self::Urgent => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Priority {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
                ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority",
            ))
        }
    }

    /// The document payload.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// An inline document proto.
        InlineDocument(std::boxed::Box<crate::model::Document>),
    }
}

/// Response message for the
/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReviewDocumentResponse {
    /// The Cloud Storage uri for the human reviewed document if the review is
    /// succeeded.
    pub gcs_destination: std::string::String,

    /// The state of the review operation.
    pub state: crate::model::review_document_response::State,

    /// The reason why the review is rejected by reviewer.
    pub rejection_reason: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ReviewDocumentResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [gcs_destination][crate::model::ReviewDocumentResponse::gcs_destination].
    pub fn set_gcs_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.gcs_destination = v.into();
        self
    }

    /// Sets the value of [state][crate::model::ReviewDocumentResponse::state].
    pub fn set_state<T: std::convert::Into<crate::model::review_document_response::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [rejection_reason][crate::model::ReviewDocumentResponse::rejection_reason].
    pub fn set_rejection_reason<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.rejection_reason = v.into();
        self
    }
}

impl wkt::message::Message for ReviewDocumentResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentResponse"
    }
}

/// Defines additional types related to [ReviewDocumentResponse].
pub mod review_document_response {
    #[allow(unused_imports)]
    use super::*;

    /// Possible states of the review operation.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The default value. This value is used if the state is omitted.
        Unspecified,
        /// The review operation is rejected by the reviewer.
        Rejected,
        /// The review operation is succeeded.
        Succeeded,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Rejected => std::option::Option::Some(1),
                Self::Succeeded => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Rejected => std::option::Option::Some("REJECTED"),
                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Rejected,
                2 => Self::Succeeded,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "REJECTED" => Self::Rejected,
                "SUCCEEDED" => Self::Succeeded,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Rejected => serializer.serialize_i32(1),
                Self::Succeeded => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.documentai.v1.ReviewDocumentResponse.State",
            ))
        }
    }
}

/// The long-running operation metadata for the
/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReviewDocumentOperationMetadata {
    /// The basic metadata of the long-running operation.
    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,

    /// The Crowd Compute question ID.
    pub question_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ReviewDocumentOperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
    pub fn set_common_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = v.map(|x| x.into());
        self
    }

    /// Sets the value of [question_id][crate::model::ReviewDocumentOperationMetadata::question_id].
    pub fn set_question_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.question_id = v.into();
        self
    }
}

impl wkt::message::Message for ReviewDocumentOperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentOperationMetadata"
    }
}

/// Evaluates the given
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] against the
/// supplied documents.
///
/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EvaluateProcessorVersionRequest {
    /// Required. The resource name of the
    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to
    /// evaluate.
    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
    ///
    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
    pub processor_version: std::string::String,

    /// Optional. The documents used in the evaluation. If unspecified, use the
    /// processor's dataset as evaluation input.
    pub evaluation_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EvaluateProcessorVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [processor_version][crate::model::EvaluateProcessorVersionRequest::processor_version].
    pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.processor_version = v.into();
        self
    }

    /// Sets the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
    pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
    {
        self.evaluation_documents = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
    pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
    {
        self.evaluation_documents = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for EvaluateProcessorVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionRequest"
    }
}

/// Metadata of the
/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EvaluateProcessorVersionMetadata {
    /// The basic metadata of the long-running operation.
    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EvaluateProcessorVersionMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
    pub fn set_common_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CommonOperationMetadata>,
    {
        self.common_metadata = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for EvaluateProcessorVersionMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionMetadata"
    }
}

/// Response of the
/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
/// method.
///
/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EvaluateProcessorVersionResponse {
    /// The resource name of the created evaluation.
    pub evaluation: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EvaluateProcessorVersionResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [evaluation][crate::model::EvaluateProcessorVersionResponse::evaluation].
    pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.evaluation = v.into();
        self
    }
}

impl wkt::message::Message for EvaluateProcessorVersionResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionResponse"
    }
}

/// Retrieves a specific Evaluation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetEvaluationRequest {
    /// Required. The resource name of the
    /// [Evaluation][google.cloud.documentai.v1.Evaluation] to get.
    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
    ///
    /// [google.cloud.documentai.v1.Evaluation]: crate::model::Evaluation
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetEvaluationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetEvaluationRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetEvaluationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.GetEvaluationRequest"
    }
}

/// Retrieves a list of evaluations for a given
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
///
/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListEvaluationsRequest {
    /// Required. The resource name of the
    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list
    /// evaluations for.
    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
    ///
    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
    pub parent: std::string::String,

    /// The standard list page size.
    /// If unspecified, at most `5` evaluations are returned.
    /// The maximum value is `100`. Values above `100` are coerced to `100`.
    pub page_size: i32,

    /// A page token, received from a previous `ListEvaluations` call.
    /// Provide this to retrieve the subsequent page.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListEvaluationsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListEvaluationsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListEvaluationsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListEvaluationsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListEvaluationsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsRequest"
    }
}

/// The response from `ListEvaluations`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListEvaluationsResponse {
    /// The evaluations requested.
    pub evaluations: std::vec::Vec<crate::model::Evaluation>,

    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListEvaluationsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [evaluations][crate::model::ListEvaluationsResponse::evaluations].
    pub fn set_evaluations<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Evaluation>,
    {
        use std::iter::Iterator;
        self.evaluations = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListEvaluationsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListEvaluationsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListEvaluationsResponse {
    type PageItem = crate::model::Evaluation;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.evaluations
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The schema defines the output of the processed document by a processor.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DocumentSchema {
    /// Display name to show to users.
    pub display_name: std::string::String,

    /// Description of the schema.
    pub description: std::string::String,

    /// Entity types of the schema.
    pub entity_types: std::vec::Vec<crate::model::document_schema::EntityType>,

    /// Metadata of the schema.
    pub metadata: std::option::Option<crate::model::document_schema::Metadata>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DocumentSchema {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [display_name][crate::model::DocumentSchema::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::DocumentSchema::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [entity_types][crate::model::DocumentSchema::entity_types].
    pub fn set_entity_types<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::document_schema::EntityType>,
    {
        use std::iter::Iterator;
        self.entity_types = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [metadata][crate::model::DocumentSchema::metadata].
    pub fn set_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::document_schema::Metadata>,
    {
        self.metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [metadata][crate::model::DocumentSchema::metadata].
    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::document_schema::Metadata>,
    {
        self.metadata = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for DocumentSchema {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema"
    }
}

/// Defines additional types related to [DocumentSchema].
pub mod document_schema {
    #[allow(unused_imports)]
    use super::*;

    /// EntityType is the wrapper of a label of the corresponding model with
    /// detailed attributes and limitations for entity-based processors. Multiple
    /// types can also compose a dependency tree to represent nested types.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct EntityType {
        /// User defined name for the type.
        pub display_name: std::string::String,

        /// Name of the type. It must be unique within the schema file and
        /// cannot be a "Common Type".  The following naming conventions are used:
        ///
        /// - Use `snake_casing`.
        /// - Name matching is case-sensitive.
        /// - Maximum 64 characters.
        /// - Must start with a letter.
        /// - Allowed characters: ASCII letters `[a-z0-9_-]`.  (For backward
        ///   compatibility internal infrastructure and tooling can handle any ascii
        ///   character.)
        /// - The `/` is sometimes used to denote a property of a type.  For example
        ///   `line_item/amount`.  This convention is deprecated, but will still be
        ///   honored for backward compatibility.
        pub name: std::string::String,

        /// The entity type that this type is derived from.  For now, one and only
        /// one should be set.
        pub base_types: std::vec::Vec<std::string::String>,

        /// Description the nested structure, or composition of an entity.
        pub properties: std::vec::Vec<crate::model::document_schema::entity_type::Property>,

        pub value_source:
            std::option::Option<crate::model::document_schema::entity_type::ValueSource>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl EntityType {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [display_name][crate::model::document_schema::EntityType::display_name].
        pub fn set_display_name<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.display_name = v.into();
            self
        }

        /// Sets the value of [name][crate::model::document_schema::EntityType::name].
        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.name = v.into();
            self
        }

        /// Sets the value of [base_types][crate::model::document_schema::EntityType::base_types].
        pub fn set_base_types<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.base_types = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [properties][crate::model::document_schema::EntityType::properties].
        pub fn set_properties<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::document_schema::entity_type::Property>,
        {
            use std::iter::Iterator;
            self.properties = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source].
        ///
        /// Note that all the setters affecting `value_source` are mutually
        /// exclusive.
        pub fn set_value_source<
            T: std::convert::Into<
                    std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.value_source = v.into();
            self
        }

        /// The value of [value_source][crate::model::document_schema::EntityType::value_source]
        /// if it holds a `EnumValues`, `None` if the field is not set or
        /// holds a different branch.
        pub fn enum_values(
            &self,
        ) -> std::option::Option<
            &std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
        > {
            #[allow(unreachable_patterns)]
            self.value_source.as_ref().and_then(|v| match v {
                crate::model::document_schema::entity_type::ValueSource::EnumValues(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source]
        /// to hold a `EnumValues`.
        ///
        /// Note that all the setters affecting `value_source` are
        /// mutually exclusive.
        pub fn set_enum_values<
            T: std::convert::Into<
                    std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.value_source = std::option::Option::Some(
                crate::model::document_schema::entity_type::ValueSource::EnumValues(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for EntityType {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType"
        }
    }

    /// Defines additional types related to [EntityType].
    pub mod entity_type {
        #[allow(unused_imports)]
        use super::*;

        /// Defines the a list of enum values.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct EnumValues {
            /// The individual values that this enum values type can include.
            pub values: std::vec::Vec<std::string::String>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl EnumValues {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [values][crate::model::document_schema::entity_type::EnumValues::values].
            pub fn set_values<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<std::string::String>,
            {
                use std::iter::Iterator;
                self.values = v.into_iter().map(|i| i.into()).collect();
                self
            }
        }

        impl wkt::message::Message for EnumValues {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues"
            }
        }

        /// Defines properties that can be part of the entity type.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Property {
            /// The name of the property.  Follows the same guidelines as the
            /// EntityType name.
            pub name: std::string::String,

            /// User defined name for the property.
            pub display_name: std::string::String,

            /// A reference to the value type of the property.  This type is subject
            /// to the same conventions as the `Entity.base_types` field.
            pub value_type: std::string::String,

            /// Occurrence type limits the number of instances an entity type appears
            /// in the document.
            pub occurrence_type:
                crate::model::document_schema::entity_type::property::OccurrenceType,

            /// Specifies how the entity's value is obtained.
            pub method: crate::model::document_schema::entity_type::property::Method,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Property {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [name][crate::model::document_schema::entity_type::Property::name].
            pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
                self.name = v.into();
                self
            }

            /// Sets the value of [display_name][crate::model::document_schema::entity_type::Property::display_name].
            pub fn set_display_name<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.display_name = v.into();
                self
            }

            /// Sets the value of [value_type][crate::model::document_schema::entity_type::Property::value_type].
            pub fn set_value_type<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.value_type = v.into();
                self
            }

            /// Sets the value of [occurrence_type][crate::model::document_schema::entity_type::Property::occurrence_type].
            pub fn set_occurrence_type<
                T: std::convert::Into<
                        crate::model::document_schema::entity_type::property::OccurrenceType,
                    >,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.occurrence_type = v.into();
                self
            }

            /// Sets the value of [method][crate::model::document_schema::entity_type::Property::method].
            pub fn set_method<
                T: std::convert::Into<crate::model::document_schema::entity_type::property::Method>,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.method = v.into();
                self
            }
        }

        impl wkt::message::Message for Property {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.Property"
            }
        }

        /// Defines additional types related to [Property].
        pub mod property {
            #[allow(unused_imports)]
            use super::*;

            /// Types of occurrences of the entity type in the document.  This
            /// represents the number of instances, not mentions, of an entity.
            /// For example, a bank statement might only have one
            /// `account_number`, but this account number can be mentioned in several
            /// places on the document.  In this case, the `account_number` is
            /// considered a `REQUIRED_ONCE` entity type. If, on the other hand, we
            /// expect a bank statement to contain the status of multiple different
            /// accounts for the customers, the occurrence type is set to
            /// `REQUIRED_MULTIPLE`.
            ///
            /// # Working with unknown values
            ///
            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
            /// additional enum variants at any time. Adding new variants is not considered
            /// a breaking change. Applications should write their code in anticipation of:
            ///
            /// - New values appearing in future releases of the client library, **and**
            /// - New values received dynamically, without application changes.
            ///
            /// Please consult the [Working with enums] section in the user guide for some
            /// guidelines.
            ///
            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum OccurrenceType {
                /// Unspecified occurrence type.
                Unspecified,
                /// There will be zero or one instance of this entity type.  The same
                /// entity instance may be mentioned multiple times.
                OptionalOnce,
                /// The entity type will appear zero or multiple times.
                OptionalMultiple,
                /// The entity type will only appear exactly once.  The same
                /// entity instance may be mentioned multiple times.
                RequiredOnce,
                /// The entity type will appear once or more times.
                RequiredMultiple,
                /// If set, the enum was initialized with an unknown value.
                ///
                /// Applications can examine the value using [OccurrenceType::value] or
                /// [OccurrenceType::name].
                UnknownValue(occurrence_type::UnknownValue),
            }

            #[doc(hidden)]
            pub mod occurrence_type {
                #[allow(unused_imports)]
                use super::*;
                #[derive(Clone, Debug, PartialEq)]
                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
            }

            impl OccurrenceType {
                /// Gets the enum value.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the string representation of enums.
                pub fn value(&self) -> std::option::Option<i32> {
                    match self {
                        Self::Unspecified => std::option::Option::Some(0),
                        Self::OptionalOnce => std::option::Option::Some(1),
                        Self::OptionalMultiple => std::option::Option::Some(2),
                        Self::RequiredOnce => std::option::Option::Some(3),
                        Self::RequiredMultiple => std::option::Option::Some(4),
                        Self::UnknownValue(u) => u.0.value(),
                    }
                }

                /// Gets the enum value as a string.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the integer representation of enums.
                pub fn name(&self) -> std::option::Option<&str> {
                    match self {
                        Self::Unspecified => {
                            std::option::Option::Some("OCCURRENCE_TYPE_UNSPECIFIED")
                        }
                        Self::OptionalOnce => std::option::Option::Some("OPTIONAL_ONCE"),
                        Self::OptionalMultiple => std::option::Option::Some("OPTIONAL_MULTIPLE"),
                        Self::RequiredOnce => std::option::Option::Some("REQUIRED_ONCE"),
                        Self::RequiredMultiple => std::option::Option::Some("REQUIRED_MULTIPLE"),
                        Self::UnknownValue(u) => u.0.name(),
                    }
                }
            }

            impl std::default::Default for OccurrenceType {
                fn default() -> Self {
                    use std::convert::From;
                    Self::from(0)
                }
            }

            impl std::fmt::Display for OccurrenceType {
                fn fmt(
                    &self,
                    f: &mut std::fmt::Formatter<'_>,
                ) -> std::result::Result<(), std::fmt::Error> {
                    wkt::internal::display_enum(f, self.name(), self.value())
                }
            }

            impl std::convert::From<i32> for OccurrenceType {
                fn from(value: i32) -> Self {
                    match value {
                        0 => Self::Unspecified,
                        1 => Self::OptionalOnce,
                        2 => Self::OptionalMultiple,
                        3 => Self::RequiredOnce,
                        4 => Self::RequiredMultiple,
                        _ => Self::UnknownValue(occurrence_type::UnknownValue(
                            wkt::internal::UnknownEnumValue::Integer(value),
                        )),
                    }
                }
            }

            impl std::convert::From<&str> for OccurrenceType {
                fn from(value: &str) -> Self {
                    use std::string::ToString;
                    match value {
                        "OCCURRENCE_TYPE_UNSPECIFIED" => Self::Unspecified,
                        "OPTIONAL_ONCE" => Self::OptionalOnce,
                        "OPTIONAL_MULTIPLE" => Self::OptionalMultiple,
                        "REQUIRED_ONCE" => Self::RequiredOnce,
                        "REQUIRED_MULTIPLE" => Self::RequiredMultiple,
                        _ => Self::UnknownValue(occurrence_type::UnknownValue(
                            wkt::internal::UnknownEnumValue::String(value.to_string()),
                        )),
                    }
                }
            }

            impl serde::ser::Serialize for OccurrenceType {
                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
                where
                    S: serde::Serializer,
                {
                    match self {
                        Self::Unspecified => serializer.serialize_i32(0),
                        Self::OptionalOnce => serializer.serialize_i32(1),
                        Self::OptionalMultiple => serializer.serialize_i32(2),
                        Self::RequiredOnce => serializer.serialize_i32(3),
                        Self::RequiredMultiple => serializer.serialize_i32(4),
                        Self::UnknownValue(u) => u.0.serialize(serializer),
                    }
                }
            }

            impl<'de> serde::de::Deserialize<'de> for OccurrenceType {
                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
                where
                    D: serde::Deserializer<'de>,
                {
                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<OccurrenceType>::new(
                        ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType"))
                }
            }

            /// Specifies how the entity's value is obtained from the document.
            ///
            /// # Working with unknown values
            ///
            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
            /// additional enum variants at any time. Adding new variants is not considered
            /// a breaking change. Applications should write their code in anticipation of:
            ///
            /// - New values appearing in future releases of the client library, **and**
            /// - New values received dynamically, without application changes.
            ///
            /// Please consult the [Working with enums] section in the user guide for some
            /// guidelines.
            ///
            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum Method {
                /// Unspecified method. It defaults to `EXTRACT`.
                Unspecified,
                /// The entity's value is directly extracted as-is from the document
                /// text.
                Extract,
                /// The entity's value is derived through inference and is not
                /// necessarily an exact text extraction from the document.
                Derive,
                /// If set, the enum was initialized with an unknown value.
                ///
                /// Applications can examine the value using [Method::value] or
                /// [Method::name].
                UnknownValue(method::UnknownValue),
            }

            #[doc(hidden)]
            pub mod method {
                #[allow(unused_imports)]
                use super::*;
                #[derive(Clone, Debug, PartialEq)]
                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
            }

            impl Method {
                /// Gets the enum value.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the string representation of enums.
                pub fn value(&self) -> std::option::Option<i32> {
                    match self {
                        Self::Unspecified => std::option::Option::Some(0),
                        Self::Extract => std::option::Option::Some(1),
                        Self::Derive => std::option::Option::Some(2),
                        Self::UnknownValue(u) => u.0.value(),
                    }
                }

                /// Gets the enum value as a string.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the integer representation of enums.
                pub fn name(&self) -> std::option::Option<&str> {
                    match self {
                        Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
                        Self::Extract => std::option::Option::Some("EXTRACT"),
                        Self::Derive => std::option::Option::Some("DERIVE"),
                        Self::UnknownValue(u) => u.0.name(),
                    }
                }
            }

            impl std::default::Default for Method {
                fn default() -> Self {
                    use std::convert::From;
                    Self::from(0)
                }
            }

            impl std::fmt::Display for Method {
                fn fmt(
                    &self,
                    f: &mut std::fmt::Formatter<'_>,
                ) -> std::result::Result<(), std::fmt::Error> {
                    wkt::internal::display_enum(f, self.name(), self.value())
                }
            }

            impl std::convert::From<i32> for Method {
                fn from(value: i32) -> Self {
                    match value {
                        0 => Self::Unspecified,
                        1 => Self::Extract,
                        2 => Self::Derive,
                        _ => Self::UnknownValue(method::UnknownValue(
                            wkt::internal::UnknownEnumValue::Integer(value),
                        )),
                    }
                }
            }

            impl std::convert::From<&str> for Method {
                fn from(value: &str) -> Self {
                    use std::string::ToString;
                    match value {
                        "METHOD_UNSPECIFIED" => Self::Unspecified,
                        "EXTRACT" => Self::Extract,
                        "DERIVE" => Self::Derive,
                        _ => Self::UnknownValue(method::UnknownValue(
                            wkt::internal::UnknownEnumValue::String(value.to_string()),
                        )),
                    }
                }
            }

            impl serde::ser::Serialize for Method {
                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
                where
                    S: serde::Serializer,
                {
                    match self {
                        Self::Unspecified => serializer.serialize_i32(0),
                        Self::Extract => serializer.serialize_i32(1),
                        Self::Derive => serializer.serialize_i32(2),
                        Self::UnknownValue(u) => u.0.serialize(serializer),
                    }
                }
            }

            impl<'de> serde::de::Deserialize<'de> for Method {
                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
                where
                    D: serde::Deserializer<'de>,
                {
                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
                        ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.Method",
                    ))
                }
            }
        }

        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum ValueSource {
            /// If specified, lists all the possible values for this entity.  This
            /// should not be more than a handful of values.  If the number of values
            /// is >10 or could change frequently use the `EntityType.value_ontology`
            /// field and specify a list of all possible values in a value ontology
            /// file.
            EnumValues(std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>),
        }
    }

    /// Metadata for global schema behavior.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Metadata {
        /// If true, a `document` entity type can be applied to subdocument
        /// (splitting). Otherwise, it can only be applied to the entire document
        /// (classification).
        pub document_splitter: bool,

        /// If true, on a given page, there can be multiple `document` annotations
        /// covering it.
        pub document_allow_multiple_labels: bool,

        /// If set, all the nested entities must be prefixed with the parents.
        pub prefixed_naming_on_properties: bool,

        /// If set, we will skip the naming format validation in the schema. So the
        /// string values in `DocumentSchema.EntityType.name` and
        /// `DocumentSchema.EntityType.Property.name` will not be checked.
        pub skip_naming_validation: bool,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Metadata {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [document_splitter][crate::model::document_schema::Metadata::document_splitter].
        pub fn set_document_splitter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.document_splitter = v.into();
            self
        }

        /// Sets the value of [document_allow_multiple_labels][crate::model::document_schema::Metadata::document_allow_multiple_labels].
        pub fn set_document_allow_multiple_labels<T: std::convert::Into<bool>>(
            mut self,
            v: T,
        ) -> Self {
            self.document_allow_multiple_labels = v.into();
            self
        }

        /// Sets the value of [prefixed_naming_on_properties][crate::model::document_schema::Metadata::prefixed_naming_on_properties].
        pub fn set_prefixed_naming_on_properties<T: std::convert::Into<bool>>(
            mut self,
            v: T,
        ) -> Self {
            self.prefixed_naming_on_properties = v.into();
            self
        }

        /// Sets the value of [skip_naming_validation][crate::model::document_schema::Metadata::skip_naming_validation].
        pub fn set_skip_naming_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.skip_naming_validation = v.into();
            self
        }
    }

    impl wkt::message::Message for Metadata {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.Metadata"
        }
    }
}

/// Gives a short summary of an evaluation, and links to the evaluation itself.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EvaluationReference {
    /// The resource name of the Long Running Operation for the evaluation.
    pub operation: std::string::String,

    /// The resource name of the evaluation.
    pub evaluation: std::string::String,

    /// An aggregate of the statistics for the evaluation with fuzzy matching on.
    pub aggregate_metrics: std::option::Option<crate::model::evaluation::Metrics>,

    /// An aggregate of the statistics for the evaluation with fuzzy matching off.
    pub aggregate_metrics_exact: std::option::Option<crate::model::evaluation::Metrics>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EvaluationReference {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [operation][crate::model::EvaluationReference::operation].
    pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.operation = v.into();
        self
    }

    /// Sets the value of [evaluation][crate::model::EvaluationReference::evaluation].
    pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.evaluation = v.into();
        self
    }

    /// Sets the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
    pub fn set_aggregate_metrics<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::evaluation::Metrics>,
    {
        self.aggregate_metrics = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
    pub fn set_or_clear_aggregate_metrics<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::evaluation::Metrics>,
    {
        self.aggregate_metrics = v.map(|x| x.into());
        self
    }

    /// Sets the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
    pub fn set_aggregate_metrics_exact<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::evaluation::Metrics>,
    {
        self.aggregate_metrics_exact = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
    pub fn set_or_clear_aggregate_metrics_exact<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::evaluation::Metrics>,
    {
        self.aggregate_metrics_exact = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for EvaluationReference {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.EvaluationReference"
    }
}

/// An evaluation of a ProcessorVersion's performance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Evaluation {
    /// The resource name of the evaluation.
    /// Format:
    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}`
    pub name: std::string::String,

    /// The time that the evaluation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Counters for the documents used in the evaluation.
    pub document_counters: std::option::Option<crate::model::evaluation::Counters>,

    /// Metrics for all the entities in aggregate.
    pub all_entities_metrics: std::option::Option<crate::model::evaluation::MultiConfidenceMetrics>,

    /// Metrics across confidence levels, for different entities.
    pub entity_metrics: std::collections::HashMap<
        std::string::String,
        crate::model::evaluation::MultiConfidenceMetrics,
    >,

    /// The KMS key name used for encryption.
    pub kms_key_name: std::string::String,

    /// The KMS key version with which data is encrypted.
    pub kms_key_version_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Evaluation {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Evaluation::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Evaluation::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Evaluation::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [document_counters][crate::model::Evaluation::document_counters].
    pub fn set_document_counters<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::evaluation::Counters>,
    {
        self.document_counters = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [document_counters][crate::model::Evaluation::document_counters].
    pub fn set_or_clear_document_counters<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::evaluation::Counters>,
    {
        self.document_counters = v.map(|x| x.into());
        self
    }

    /// Sets the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
    pub fn set_all_entities_metrics<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
    {
        self.all_entities_metrics = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
    pub fn set_or_clear_all_entities_metrics<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
    {
        self.all_entities_metrics = v.map(|x| x.into());
        self
    }

    /// Sets the value of [entity_metrics][crate::model::Evaluation::entity_metrics].
    pub fn set_entity_metrics<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
    {
        use std::iter::Iterator;
        self.entity_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [kms_key_name][crate::model::Evaluation::kms_key_name].
    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.kms_key_name = v.into();
        self
    }

    /// Sets the value of [kms_key_version_name][crate::model::Evaluation::kms_key_version_name].
    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.kms_key_version_name = v.into();
        self
    }
}

impl wkt::message::Message for Evaluation {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.Evaluation"
    }
}

/// Defines additional types related to [Evaluation].
pub mod evaluation {
    #[allow(unused_imports)]
    use super::*;

    /// Evaluation counters for the documents that were used.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Counters {
        /// How many documents were sent for evaluation.
        pub input_documents_count: i32,

        /// How many documents were not included in the evaluation as they didn't
        /// pass validation.
        pub invalid_documents_count: i32,

        /// How many documents were not included in the evaluation as Document AI
        /// failed to process them.
        pub failed_documents_count: i32,

        /// How many documents were used in the evaluation.
        pub evaluated_documents_count: i32,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Counters {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [input_documents_count][crate::model::evaluation::Counters::input_documents_count].
        pub fn set_input_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.input_documents_count = v.into();
            self
        }

        /// Sets the value of [invalid_documents_count][crate::model::evaluation::Counters::invalid_documents_count].
        pub fn set_invalid_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.invalid_documents_count = v.into();
            self
        }

        /// Sets the value of [failed_documents_count][crate::model::evaluation::Counters::failed_documents_count].
        pub fn set_failed_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.failed_documents_count = v.into();
            self
        }

        /// Sets the value of [evaluated_documents_count][crate::model::evaluation::Counters::evaluated_documents_count].
        pub fn set_evaluated_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.evaluated_documents_count = v.into();
            self
        }
    }

    impl wkt::message::Message for Counters {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Counters"
        }
    }

    /// Evaluation metrics, either in aggregate or about a specific entity.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Metrics {
        /// The calculated precision.
        pub precision: f32,

        /// The calculated recall.
        pub recall: f32,

        /// The calculated f1 score.
        pub f1_score: f32,

        /// The amount of occurrences in predicted documents.
        pub predicted_occurrences_count: i32,

        /// The amount of occurrences in ground truth documents.
        pub ground_truth_occurrences_count: i32,

        /// The amount of documents with a predicted occurrence.
        pub predicted_document_count: i32,

        /// The amount of documents with a ground truth occurrence.
        pub ground_truth_document_count: i32,

        /// The amount of true positives.
        pub true_positives_count: i32,

        /// The amount of false positives.
        pub false_positives_count: i32,

        /// The amount of false negatives.
        pub false_negatives_count: i32,

        /// The amount of documents that had an occurrence of this label.
        pub total_documents_count: i32,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Metrics {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [precision][crate::model::evaluation::Metrics::precision].
        pub fn set_precision<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
            self.precision = v.into();
            self
        }

        /// Sets the value of [recall][crate::model::evaluation::Metrics::recall].
        pub fn set_recall<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
            self.recall = v.into();
            self
        }

        /// Sets the value of [f1_score][crate::model::evaluation::Metrics::f1_score].
        pub fn set_f1_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
            self.f1_score = v.into();
            self
        }

        /// Sets the value of [predicted_occurrences_count][crate::model::evaluation::Metrics::predicted_occurrences_count].
        pub fn set_predicted_occurrences_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.predicted_occurrences_count = v.into();
            self
        }

        /// Sets the value of [ground_truth_occurrences_count][crate::model::evaluation::Metrics::ground_truth_occurrences_count].
        pub fn set_ground_truth_occurrences_count<T: std::convert::Into<i32>>(
            mut self,
            v: T,
        ) -> Self {
            self.ground_truth_occurrences_count = v.into();
            self
        }

        /// Sets the value of [predicted_document_count][crate::model::evaluation::Metrics::predicted_document_count].
        pub fn set_predicted_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.predicted_document_count = v.into();
            self
        }

        /// Sets the value of [ground_truth_document_count][crate::model::evaluation::Metrics::ground_truth_document_count].
        pub fn set_ground_truth_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.ground_truth_document_count = v.into();
            self
        }

        /// Sets the value of [true_positives_count][crate::model::evaluation::Metrics::true_positives_count].
        pub fn set_true_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.true_positives_count = v.into();
            self
        }

        /// Sets the value of [false_positives_count][crate::model::evaluation::Metrics::false_positives_count].
        pub fn set_false_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.false_positives_count = v.into();
            self
        }

        /// Sets the value of [false_negatives_count][crate::model::evaluation::Metrics::false_negatives_count].
        pub fn set_false_negatives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.false_negatives_count = v.into();
            self
        }

        /// Sets the value of [total_documents_count][crate::model::evaluation::Metrics::total_documents_count].
        pub fn set_total_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.total_documents_count = v.into();
            self
        }
    }

    impl wkt::message::Message for Metrics {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Metrics"
        }
    }

    /// Evaluations metrics, at a specific confidence level.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct ConfidenceLevelMetrics {
        /// The confidence level.
        pub confidence_level: f32,

        /// The metrics at the specific confidence level.
        pub metrics: std::option::Option<crate::model::evaluation::Metrics>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl ConfidenceLevelMetrics {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [confidence_level][crate::model::evaluation::ConfidenceLevelMetrics::confidence_level].
        pub fn set_confidence_level<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
            self.confidence_level = v.into();
            self
        }

        /// Sets the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
        pub fn set_metrics<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::evaluation::Metrics>,
        {
            self.metrics = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
        pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::evaluation::Metrics>,
        {
            self.metrics = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for ConfidenceLevelMetrics {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics"
        }
    }

    /// Metrics across multiple confidence levels.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct MultiConfidenceMetrics {
        /// Metrics across confidence levels with fuzzy matching enabled.
        pub confidence_level_metrics:
            std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,

        /// Metrics across confidence levels with only exact matching.
        pub confidence_level_metrics_exact:
            std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,

        /// The calculated area under the precision recall curve (AUPRC), computed by
        /// integrating over all confidence thresholds.
        pub auprc: f32,

        /// The Estimated Calibration Error (ECE) of the confidence of the predicted
        /// entities.
        pub estimated_calibration_error: f32,

        /// The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching
        /// only.
        pub auprc_exact: f32,

        /// The ECE for the predicted entities with fuzzy matching disabled, i.e.,
        /// exact matching only.
        pub estimated_calibration_error_exact: f32,

        /// The metrics type for the label.
        pub metrics_type: crate::model::evaluation::multi_confidence_metrics::MetricsType,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl MultiConfidenceMetrics {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [confidence_level_metrics][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics].
        pub fn set_confidence_level_metrics<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
        {
            use std::iter::Iterator;
            self.confidence_level_metrics = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [confidence_level_metrics_exact][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics_exact].
        pub fn set_confidence_level_metrics_exact<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
        {
            use std::iter::Iterator;
            self.confidence_level_metrics_exact = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [auprc][crate::model::evaluation::MultiConfidenceMetrics::auprc].
        pub fn set_auprc<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
            self.auprc = v.into();
            self
        }

        /// Sets the value of [estimated_calibration_error][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error].
        pub fn set_estimated_calibration_error<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
            self.estimated_calibration_error = v.into();
            self
        }

        /// Sets the value of [auprc_exact][crate::model::evaluation::MultiConfidenceMetrics::auprc_exact].
        pub fn set_auprc_exact<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
            self.auprc_exact = v.into();
            self
        }

        /// Sets the value of [estimated_calibration_error_exact][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error_exact].
        pub fn set_estimated_calibration_error_exact<T: std::convert::Into<f32>>(
            mut self,
            v: T,
        ) -> Self {
            self.estimated_calibration_error_exact = v.into();
            self
        }

        /// Sets the value of [metrics_type][crate::model::evaluation::MultiConfidenceMetrics::metrics_type].
        pub fn set_metrics_type<
            T: std::convert::Into<crate::model::evaluation::multi_confidence_metrics::MetricsType>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.metrics_type = v.into();
            self
        }
    }

    impl wkt::message::Message for MultiConfidenceMetrics {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics"
        }
    }

    /// Defines additional types related to [MultiConfidenceMetrics].
    pub mod multi_confidence_metrics {
        #[allow(unused_imports)]
        use super::*;

        /// A type that determines how metrics should be interpreted.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum MetricsType {
            /// The metrics type is unspecified. By default, metrics without a
            /// particular specification are for leaf entity types (i.e., top-level
            /// entity types without child types, or child types which are not
            /// parent types themselves).
            Unspecified,
            /// Indicates whether metrics for this particular label type represent an
            /// aggregate of metrics for other types instead of being based on actual
            /// TP/FP/FN values for the label type. Metrics for parent (i.e., non-leaf)
            /// entity types are an aggregate of metrics for their children.
            Aggregate,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [MetricsType::value] or
            /// [MetricsType::name].
            UnknownValue(metrics_type::UnknownValue),
        }

        #[doc(hidden)]
        pub mod metrics_type {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl MetricsType {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::Aggregate => std::option::Option::Some(1),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("METRICS_TYPE_UNSPECIFIED"),
                    Self::Aggregate => std::option::Option::Some("AGGREGATE"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for MetricsType {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for MetricsType {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for MetricsType {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::Aggregate,
                    _ => Self::UnknownValue(metrics_type::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for MetricsType {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "METRICS_TYPE_UNSPECIFIED" => Self::Unspecified,
                    "AGGREGATE" => Self::Aggregate,
                    _ => Self::UnknownValue(metrics_type::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for MetricsType {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::Aggregate => serializer.serialize_i32(1),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for MetricsType {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricsType>::new(
                    ".google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType",
                ))
            }
        }
    }
}

/// A vertex represents a 2D point in the image.
/// NOTE: the vertex coordinates are in the same scale as the original image.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Vertex {
    /// X coordinate.
    pub x: i32,

    /// Y coordinate (starts from the top of the image).
    pub y: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Vertex {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [x][crate::model::Vertex::x].
    pub fn set_x<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.x = v.into();
        self
    }

    /// Sets the value of [y][crate::model::Vertex::y].
    pub fn set_y<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.y = v.into();
        self
    }
}

impl wkt::message::Message for Vertex {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.Vertex"
    }
}

/// A vertex represents a 2D point in the image.
/// NOTE: the normalized vertex coordinates are relative to the original image
/// and range from 0 to 1.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NormalizedVertex {
    /// X coordinate.
    pub x: f32,

    /// Y coordinate (starts from the top of the image).
    pub y: f32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl NormalizedVertex {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [x][crate::model::NormalizedVertex::x].
    pub fn set_x<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
        self.x = v.into();
        self
    }

    /// Sets the value of [y][crate::model::NormalizedVertex::y].
    pub fn set_y<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
        self.y = v.into();
        self
    }
}

impl wkt::message::Message for NormalizedVertex {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.NormalizedVertex"
    }
}

/// A bounding polygon for the detected image annotation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BoundingPoly {
    /// The bounding polygon vertices.
    pub vertices: std::vec::Vec<crate::model::Vertex>,

    /// The bounding polygon normalized vertices.
    pub normalized_vertices: std::vec::Vec<crate::model::NormalizedVertex>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BoundingPoly {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [vertices][crate::model::BoundingPoly::vertices].
    pub fn set_vertices<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Vertex>,
    {
        use std::iter::Iterator;
        self.vertices = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [normalized_vertices][crate::model::BoundingPoly::normalized_vertices].
    pub fn set_normalized_vertices<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::NormalizedVertex>,
    {
        use std::iter::Iterator;
        self.normalized_vertices = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for BoundingPoly {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.BoundingPoly"
    }
}

/// The common metadata for long running operations.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CommonOperationMetadata {
    /// The state of the operation.
    pub state: crate::model::common_operation_metadata::State,

    /// A message providing more details about the current state of processing.
    pub state_message: std::string::String,

    /// A related resource to this operation.
    pub resource: std::string::String,

    /// The creation time of the operation.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// The last update time of the operation.
    pub update_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CommonOperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [state][crate::model::CommonOperationMetadata::state].
    pub fn set_state<T: std::convert::Into<crate::model::common_operation_metadata::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_message][crate::model::CommonOperationMetadata::state_message].
    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_message = v.into();
        self
    }

    /// Sets the value of [resource][crate::model::CommonOperationMetadata::resource].
    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::CommonOperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::CommonOperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::CommonOperationMetadata::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::CommonOperationMetadata::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CommonOperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.CommonOperationMetadata"
    }
}

/// Defines additional types related to [CommonOperationMetadata].
pub mod common_operation_metadata {
    #[allow(unused_imports)]
    use super::*;

    /// State of the longrunning operation.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Unspecified state.
        Unspecified,
        /// Operation is still running.
        Running,
        /// Operation is being cancelled.
        Cancelling,
        /// Operation succeeded.
        Succeeded,
        /// Operation failed.
        Failed,
        /// Operation is cancelled.
        Cancelled,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Running => std::option::Option::Some(1),
                Self::Cancelling => std::option::Option::Some(2),
                Self::Succeeded => std::option::Option::Some(3),
                Self::Failed => std::option::Option::Some(4),
                Self::Cancelled => std::option::Option::Some(5),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Running => std::option::Option::Some("RUNNING"),
                Self::Cancelling => std::option::Option::Some("CANCELLING"),
                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Cancelled => std::option::Option::Some("CANCELLED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Running,
                2 => Self::Cancelling,
                3 => Self::Succeeded,
                4 => Self::Failed,
                5 => Self::Cancelled,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "RUNNING" => Self::Running,
                "CANCELLING" => Self::Cancelling,
                "SUCCEEDED" => Self::Succeeded,
                "FAILED" => Self::Failed,
                "CANCELLED" => Self::Cancelled,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Running => serializer.serialize_i32(1),
                Self::Cancelling => serializer.serialize_i32(2),
                Self::Succeeded => serializer.serialize_i32(3),
                Self::Failed => serializer.serialize_i32(4),
                Self::Cancelled => serializer.serialize_i32(5),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.documentai.v1.CommonOperationMetadata.State",
            ))
        }
    }
}

/// A processor version is an implementation of a processor. Each processor
/// can have multiple versions, pretrained by Google internally or uptrained
/// by the customer. A processor can only have one default version at a time.
/// Its document-processing behavior is defined by that version.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProcessorVersion {
    /// Identifier. The resource name of the processor version.
    /// Format:
    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}`
    pub name: std::string::String,

    /// The display name of the processor version.
    pub display_name: std::string::String,

    /// Output only. The schema of the processor version. Describes the output.
    pub document_schema: std::option::Option<crate::model::DocumentSchema>,

    /// Output only. The state of the processor version.
    pub state: crate::model::processor_version::State,

    /// Output only. The time the processor version was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The most recently invoked evaluation for the processor
    /// version.
    pub latest_evaluation: std::option::Option<crate::model::EvaluationReference>,

    /// Output only. The KMS key name used for encryption.
    pub kms_key_name: std::string::String,

    /// Output only. The KMS key version with which data is encrypted.
    pub kms_key_version_name: std::string::String,

    /// Output only. Denotes that this `ProcessorVersion` is managed by Google.
    pub google_managed: bool,

    /// Output only. If set, information about the eventual deprecation of this
    /// version.
    pub deprecation_info: std::option::Option<crate::model::processor_version::DeprecationInfo>,

    /// Output only. The model type of this processor version.
    pub model_type: crate::model::processor_version::ModelType,

    /// Output only. Reserved for future use.
    pub satisfies_pzs: bool,

    /// Output only. Reserved for future use.
    pub satisfies_pzi: bool,

    /// Output only. Information about Generative AI model-based processor
    /// versions.
    pub gen_ai_model_info: std::option::Option<crate::model::processor_version::GenAiModelInfo>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ProcessorVersion {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ProcessorVersion::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::ProcessorVersion::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [document_schema][crate::model::ProcessorVersion::document_schema].
    pub fn set_document_schema<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DocumentSchema>,
    {
        self.document_schema = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [document_schema][crate::model::ProcessorVersion::document_schema].
    pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DocumentSchema>,
    {
        self.document_schema = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state][crate::model::ProcessorVersion::state].
    pub fn set_state<T: std::convert::Into<crate::model::processor_version::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::ProcessorVersion::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ProcessorVersion::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
    pub fn set_latest_evaluation<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::EvaluationReference>,
    {
        self.latest_evaluation = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
    pub fn set_or_clear_latest_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::EvaluationReference>,
    {
        self.latest_evaluation = v.map(|x| x.into());
        self
    }

    /// Sets the value of [kms_key_name][crate::model::ProcessorVersion::kms_key_name].
    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.kms_key_name = v.into();
        self
    }

    /// Sets the value of [kms_key_version_name][crate::model::ProcessorVersion::kms_key_version_name].
    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.kms_key_version_name = v.into();
        self
    }

    /// Sets the value of [google_managed][crate::model::ProcessorVersion::google_managed].
    pub fn set_google_managed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.google_managed = v.into();
        self
    }

    /// Sets the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
    pub fn set_deprecation_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
    {
        self.deprecation_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
    pub fn set_or_clear_deprecation_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
    {
        self.deprecation_info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [model_type][crate::model::ProcessorVersion::model_type].
    pub fn set_model_type<T: std::convert::Into<crate::model::processor_version::ModelType>>(
        mut self,
        v: T,
    ) -> Self {
        self.model_type = v.into();
        self
    }

    /// Sets the value of [satisfies_pzs][crate::model::ProcessorVersion::satisfies_pzs].
    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.satisfies_pzs = v.into();
        self
    }

    /// Sets the value of [satisfies_pzi][crate::model::ProcessorVersion::satisfies_pzi].
    pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.satisfies_pzi = v.into();
        self
    }

    /// Sets the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
    pub fn set_gen_ai_model_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
    {
        self.gen_ai_model_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
    pub fn set_or_clear_gen_ai_model_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
    {
        self.gen_ai_model_info = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ProcessorVersion {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion"
    }
}

/// Defines additional types related to [ProcessorVersion].
pub mod processor_version {
    #[allow(unused_imports)]
    use super::*;

    /// Information about the upcoming deprecation of this processor version.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct DeprecationInfo {
        /// The time at which this processor version will be deprecated.
        pub deprecation_time: std::option::Option<wkt::Timestamp>,

        /// If set, the processor version that will be used as a replacement.
        pub replacement_processor_version: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl DeprecationInfo {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
        pub fn set_deprecation_time<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.deprecation_time = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
        pub fn set_or_clear_deprecation_time<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.deprecation_time = v.map(|x| x.into());
            self
        }

        /// Sets the value of [replacement_processor_version][crate::model::processor_version::DeprecationInfo::replacement_processor_version].
        pub fn set_replacement_processor_version<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.replacement_processor_version = v.into();
            self
        }
    }

    impl wkt::message::Message for DeprecationInfo {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo"
        }
    }

    /// Information about Generative AI model-based processor versions.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct GenAiModelInfo {
        /// The processor version is either a pretrained Google-managed foundation
        /// model or a custom Generative AI model created by the user.
        pub model_info:
            std::option::Option<crate::model::processor_version::gen_ai_model_info::ModelInfo>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl GenAiModelInfo {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info].
        ///
        /// Note that all the setters affecting `model_info` are mutually
        /// exclusive.
        pub fn set_model_info<
            T: std::convert::Into<
                    std::option::Option<
                        crate::model::processor_version::gen_ai_model_info::ModelInfo,
                    >,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.model_info = v.into();
            self
        }

        /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
        /// if it holds a `FoundationGenAiModelInfo`, `None` if the field is not set or
        /// holds a different branch.
        pub fn foundation_gen_ai_model_info(
            &self,
        ) -> std::option::Option<
            &std::boxed::Box<
                crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
            >,
        > {
            #[allow(unreachable_patterns)]
            self.model_info.as_ref().and_then(|v| match v {
                crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(v) => std::option::Option::Some(v),
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
        /// to hold a `FoundationGenAiModelInfo`.
        ///
        /// Note that all the setters affecting `model_info` are
        /// mutually exclusive.
        pub fn set_foundation_gen_ai_model_info<T: std::convert::Into<std::boxed::Box<crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo>>>(mut self, v: T) -> Self{
            self.model_info = std::option::Option::Some(
                crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(
                    v.into()
                )
            );
            self
        }

        /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
        /// if it holds a `CustomGenAiModelInfo`, `None` if the field is not set or
        /// holds a different branch.
        pub fn custom_gen_ai_model_info(
            &self,
        ) -> std::option::Option<
            &std::boxed::Box<
                crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
            >,
        > {
            #[allow(unreachable_patterns)]
            self.model_info.as_ref().and_then(|v| match v {
                crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(v) => std::option::Option::Some(v),
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
        /// to hold a `CustomGenAiModelInfo`.
        ///
        /// Note that all the setters affecting `model_info` are
        /// mutually exclusive.
        pub fn set_custom_gen_ai_model_info<
            T: std::convert::Into<
                    std::boxed::Box<
                        crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
                    >,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.model_info = std::option::Option::Some(
                crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(
                    v.into(),
                ),
            );
            self
        }
    }

    impl wkt::message::Message for GenAiModelInfo {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo"
        }
    }

    /// Defines additional types related to [GenAiModelInfo].
    pub mod gen_ai_model_info {
        #[allow(unused_imports)]
        use super::*;

        /// Information for a pretrained Google-managed foundation model.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct FoundationGenAiModelInfo {
            /// Whether finetuning is allowed for this base processor version.
            pub finetuning_allowed: bool,

            /// The minimum number of labeled documents in the training dataset
            /// required for finetuning.
            pub min_train_labeled_documents: i32,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl FoundationGenAiModelInfo {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [finetuning_allowed][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::finetuning_allowed].
            pub fn set_finetuning_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                self.finetuning_allowed = v.into();
                self
            }

            /// Sets the value of [min_train_labeled_documents][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::min_train_labeled_documents].
            pub fn set_min_train_labeled_documents<T: std::convert::Into<i32>>(
                mut self,
                v: T,
            ) -> Self {
                self.min_train_labeled_documents = v.into();
                self
            }
        }

        impl wkt::message::Message for FoundationGenAiModelInfo {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.FoundationGenAiModelInfo"
            }
        }

        /// Information for a custom Generative AI model created by the user. These
        /// are created with `Create New Version` in either the `Call foundation
        /// model` or `Fine tuning` tabs.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct CustomGenAiModelInfo {

            /// The type of custom model created by the user.
            pub custom_model_type: crate::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType,

            /// The base processor version ID for the custom model.
            pub base_processor_version_id: std::string::String,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl CustomGenAiModelInfo {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [custom_model_type][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::custom_model_type].
            pub fn set_custom_model_type<T: std::convert::Into<crate::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType>>(mut self, v: T) -> Self{
                self.custom_model_type = v.into();
                self
            }

            /// Sets the value of [base_processor_version_id][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::base_processor_version_id].
            pub fn set_base_processor_version_id<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.base_processor_version_id = v.into();
                self
            }
        }

        impl wkt::message::Message for CustomGenAiModelInfo {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo"
            }
        }

        /// Defines additional types related to [CustomGenAiModelInfo].
        pub mod custom_gen_ai_model_info {
            #[allow(unused_imports)]
            use super::*;

            /// The type of custom model created by the user.
            ///
            /// # Working with unknown values
            ///
            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
            /// additional enum variants at any time. Adding new variants is not considered
            /// a breaking change. Applications should write their code in anticipation of:
            ///
            /// - New values appearing in future releases of the client library, **and**
            /// - New values received dynamically, without application changes.
            ///
            /// Please consult the [Working with enums] section in the user guide for some
            /// guidelines.
            ///
            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum CustomModelType {
                /// The model type is unspecified.
                Unspecified,
                /// The model is a versioned foundation model.
                VersionedFoundation,
                /// The model is a finetuned foundation model.
                FineTuned,
                /// If set, the enum was initialized with an unknown value.
                ///
                /// Applications can examine the value using [CustomModelType::value] or
                /// [CustomModelType::name].
                UnknownValue(custom_model_type::UnknownValue),
            }

            #[doc(hidden)]
            pub mod custom_model_type {
                #[allow(unused_imports)]
                use super::*;
                #[derive(Clone, Debug, PartialEq)]
                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
            }

            impl CustomModelType {
                /// Gets the enum value.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the string representation of enums.
                pub fn value(&self) -> std::option::Option<i32> {
                    match self {
                        Self::Unspecified => std::option::Option::Some(0),
                        Self::VersionedFoundation => std::option::Option::Some(1),
                        Self::FineTuned => std::option::Option::Some(2),
                        Self::UnknownValue(u) => u.0.value(),
                    }
                }

                /// Gets the enum value as a string.
                ///
                /// Returns `None` if the enum contains an unknown value deserialized from
                /// the integer representation of enums.
                pub fn name(&self) -> std::option::Option<&str> {
                    match self {
                        Self::Unspecified => {
                            std::option::Option::Some("CUSTOM_MODEL_TYPE_UNSPECIFIED")
                        }
                        Self::VersionedFoundation => {
                            std::option::Option::Some("VERSIONED_FOUNDATION")
                        }
                        Self::FineTuned => std::option::Option::Some("FINE_TUNED"),
                        Self::UnknownValue(u) => u.0.name(),
                    }
                }
            }

            impl std::default::Default for CustomModelType {
                fn default() -> Self {
                    use std::convert::From;
                    Self::from(0)
                }
            }

            impl std::fmt::Display for CustomModelType {
                fn fmt(
                    &self,
                    f: &mut std::fmt::Formatter<'_>,
                ) -> std::result::Result<(), std::fmt::Error> {
                    wkt::internal::display_enum(f, self.name(), self.value())
                }
            }

            impl std::convert::From<i32> for CustomModelType {
                fn from(value: i32) -> Self {
                    match value {
                        0 => Self::Unspecified,
                        1 => Self::VersionedFoundation,
                        2 => Self::FineTuned,
                        _ => Self::UnknownValue(custom_model_type::UnknownValue(
                            wkt::internal::UnknownEnumValue::Integer(value),
                        )),
                    }
                }
            }

            impl std::convert::From<&str> for CustomModelType {
                fn from(value: &str) -> Self {
                    use std::string::ToString;
                    match value {
                        "CUSTOM_MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
                        "VERSIONED_FOUNDATION" => Self::VersionedFoundation,
                        "FINE_TUNED" => Self::FineTuned,
                        _ => Self::UnknownValue(custom_model_type::UnknownValue(
                            wkt::internal::UnknownEnumValue::String(value.to_string()),
                        )),
                    }
                }
            }

            impl serde::ser::Serialize for CustomModelType {
                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
                where
                    S: serde::Serializer,
                {
                    match self {
                        Self::Unspecified => serializer.serialize_i32(0),
                        Self::VersionedFoundation => serializer.serialize_i32(1),
                        Self::FineTuned => serializer.serialize_i32(2),
                        Self::UnknownValue(u) => u.0.serialize(serializer),
                    }
                }
            }

            impl<'de> serde::de::Deserialize<'de> for CustomModelType {
                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
                where
                    D: serde::Deserializer<'de>,
                {
                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<CustomModelType>::new(
                        ".google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo.CustomModelType"))
                }
            }
        }

        /// The processor version is either a pretrained Google-managed foundation
        /// model or a custom Generative AI model created by the user.
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum ModelInfo {
            /// Information for a pretrained Google-managed foundation model.
            FoundationGenAiModelInfo(
                std::boxed::Box<
                    crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
                >,
            ),
            /// Information for a custom Generative AI model created by the user.
            CustomGenAiModelInfo(
                std::boxed::Box<
                    crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
                >,
            ),
        }
    }

    /// The possible states of the processor version.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The processor version is in an unspecified state.
        Unspecified,
        /// The processor version is deployed and can be used for processing.
        Deployed,
        /// The processor version is being deployed.
        Deploying,
        /// The processor version is not deployed and cannot be used for processing.
        Undeployed,
        /// The processor version is being undeployed.
        Undeploying,
        /// The processor version is being created.
        Creating,
        /// The processor version is being deleted.
        Deleting,
        /// The processor version failed and is in an indeterminate state.
        Failed,
        /// The processor version is being imported.
        Importing,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Deployed => std::option::Option::Some(1),
                Self::Deploying => std::option::Option::Some(2),
                Self::Undeployed => std::option::Option::Some(3),
                Self::Undeploying => std::option::Option::Some(4),
                Self::Creating => std::option::Option::Some(5),
                Self::Deleting => std::option::Option::Some(6),
                Self::Failed => std::option::Option::Some(7),
                Self::Importing => std::option::Option::Some(8),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Deployed => std::option::Option::Some("DEPLOYED"),
                Self::Deploying => std::option::Option::Some("DEPLOYING"),
                Self::Undeployed => std::option::Option::Some("UNDEPLOYED"),
                Self::Undeploying => std::option::Option::Some("UNDEPLOYING"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Importing => std::option::Option::Some("IMPORTING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Deployed,
                2 => Self::Deploying,
                3 => Self::Undeployed,
                4 => Self::Undeploying,
                5 => Self::Creating,
                6 => Self::Deleting,
                7 => Self::Failed,
                8 => Self::Importing,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "DEPLOYED" => Self::Deployed,
                "DEPLOYING" => Self::Deploying,
                "UNDEPLOYED" => Self::Undeployed,
                "UNDEPLOYING" => Self::Undeploying,
                "CREATING" => Self::Creating,
                "DELETING" => Self::Deleting,
                "FAILED" => Self::Failed,
                "IMPORTING" => Self::Importing,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Deployed => serializer.serialize_i32(1),
                Self::Deploying => serializer.serialize_i32(2),
                Self::Undeployed => serializer.serialize_i32(3),
                Self::Undeploying => serializer.serialize_i32(4),
                Self::Creating => serializer.serialize_i32(5),
                Self::Deleting => serializer.serialize_i32(6),
                Self::Failed => serializer.serialize_i32(7),
                Self::Importing => serializer.serialize_i32(8),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.documentai.v1.ProcessorVersion.State",
            ))
        }
    }

    /// The possible model types of the processor version.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ModelType {
        /// The processor version has unspecified model type.
        Unspecified,
        /// The processor version has generative model type.
        Generative,
        /// The processor version has custom model type.
        Custom,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [ModelType::value] or
        /// [ModelType::name].
        UnknownValue(model_type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod model_type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl ModelType {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Generative => std::option::Option::Some(1),
                Self::Custom => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("MODEL_TYPE_UNSPECIFIED"),
                Self::Generative => std::option::Option::Some("MODEL_TYPE_GENERATIVE"),
                Self::Custom => std::option::Option::Some("MODEL_TYPE_CUSTOM"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for ModelType {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for ModelType {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for ModelType {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Generative,
                2 => Self::Custom,
                _ => Self::UnknownValue(model_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for ModelType {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
                "MODEL_TYPE_GENERATIVE" => Self::Generative,
                "MODEL_TYPE_CUSTOM" => Self::Custom,
                _ => Self::UnknownValue(model_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for ModelType {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Generative => serializer.serialize_i32(1),
                Self::Custom => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for ModelType {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModelType>::new(
                ".google.cloud.documentai.v1.ProcessorVersion.ModelType",
            ))
        }
    }
}

/// Contains the alias and the aliased resource name of processor version.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProcessorVersionAlias {
    /// The alias in the form of `processor_version` resource name.
    pub alias: std::string::String,

    /// The resource name of aliased processor version.
    pub processor_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ProcessorVersionAlias {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [alias][crate::model::ProcessorVersionAlias::alias].
    pub fn set_alias<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.alias = v.into();
        self
    }

    /// Sets the value of [processor_version][crate::model::ProcessorVersionAlias::processor_version].
    pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.processor_version = v.into();
        self
    }
}

impl wkt::message::Message for ProcessorVersionAlias {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersionAlias"
    }
}

/// The first-class citizen for Document AI. Each processor defines how to
/// extract structural information from a document.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Processor {
    /// Output only. Immutable. The resource name of the processor.
    /// Format: `projects/{project}/locations/{location}/processors/{processor}`
    pub name: std::string::String,

    /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
    /// To get a list of processor types, see
    /// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes].
    ///
    /// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
    pub r#type: std::string::String,

    /// The display name of the processor.
    pub display_name: std::string::String,

    /// Output only. The state of the processor.
    pub state: crate::model::processor::State,

    /// The default processor version.
    pub default_processor_version: std::string::String,

    /// Output only. The processor version aliases.
    pub processor_version_aliases: std::vec::Vec<crate::model::ProcessorVersionAlias>,

    /// Output only. Immutable. The http endpoint that can be called to invoke
    /// processing.
    pub process_endpoint: std::string::String,

    /// Output only. The time the processor was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// The [KMS key](https://cloud.google.com/security-key-management) used for
    /// encryption and decryption in CMEK scenarios.
    pub kms_key_name: std::string::String,

    /// Output only. Reserved for future use.
    pub satisfies_pzs: bool,

    /// Output only. Reserved for future use.
    pub satisfies_pzi: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Processor {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Processor::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [r#type][crate::model::Processor::type].
    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::Processor::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Processor::state].
    pub fn set_state<T: std::convert::Into<crate::model::processor::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [default_processor_version][crate::model::Processor::default_processor_version].
    pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.default_processor_version = v.into();
        self
    }

    /// Sets the value of [processor_version_aliases][crate::model::Processor::processor_version_aliases].
    pub fn set_processor_version_aliases<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ProcessorVersionAlias>,
    {
        use std::iter::Iterator;
        self.processor_version_aliases = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [process_endpoint][crate::model::Processor::process_endpoint].
    pub fn set_process_endpoint<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.process_endpoint = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Processor::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Processor::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [kms_key_name][crate::model::Processor::kms_key_name].
    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.kms_key_name = v.into();
        self
    }

    /// Sets the value of [satisfies_pzs][crate::model::Processor::satisfies_pzs].
    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.satisfies_pzs = v.into();
        self
    }

    /// Sets the value of [satisfies_pzi][crate::model::Processor::satisfies_pzi].
    pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.satisfies_pzi = v.into();
        self
    }
}

impl wkt::message::Message for Processor {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.Processor"
    }
}

/// Defines additional types related to [Processor].
pub mod processor {
    #[allow(unused_imports)]
    use super::*;

    /// The possible states of the processor.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The processor is in an unspecified state.
        Unspecified,
        /// The processor is enabled, i.e., has an enabled version which can
        /// currently serve processing requests and all the feature dependencies have
        /// been successfully initialized.
        Enabled,
        /// The processor is disabled.
        Disabled,
        /// The processor is being enabled, will become `ENABLED` if successful.
        Enabling,
        /// The processor is being disabled, will become `DISABLED` if successful.
        Disabling,
        /// The processor is being created, will become either `ENABLED` (for
        /// successful creation) or `FAILED` (for failed ones).
        /// Once a processor is in this state, it can then be used for document
        /// processing, but the feature dependencies of the processor might not be
        /// fully created yet.
        Creating,
        /// The processor failed during creation or initialization of feature
        /// dependencies. The user should delete the processor and recreate one as
        /// all the functionalities of the processor are disabled.
        Failed,
        /// The processor is being deleted, will be removed if successful.
        Deleting,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Enabled => std::option::Option::Some(1),
                Self::Disabled => std::option::Option::Some(2),
                Self::Enabling => std::option::Option::Some(3),
                Self::Disabling => std::option::Option::Some(4),
                Self::Creating => std::option::Option::Some(5),
                Self::Failed => std::option::Option::Some(6),
                Self::Deleting => std::option::Option::Some(7),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Enabled => std::option::Option::Some("ENABLED"),
                Self::Disabled => std::option::Option::Some("DISABLED"),
                Self::Enabling => std::option::Option::Some("ENABLING"),
                Self::Disabling => std::option::Option::Some("DISABLING"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Enabled,
                2 => Self::Disabled,
                3 => Self::Enabling,
                4 => Self::Disabling,
                5 => Self::Creating,
                6 => Self::Failed,
                7 => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ENABLED" => Self::Enabled,
                "DISABLED" => Self::Disabled,
                "ENABLING" => Self::Enabling,
                "DISABLING" => Self::Disabling,
                "CREATING" => Self::Creating,
                "FAILED" => Self::Failed,
                "DELETING" => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Enabled => serializer.serialize_i32(1),
                Self::Disabled => serializer.serialize_i32(2),
                Self::Enabling => serializer.serialize_i32(3),
                Self::Disabling => serializer.serialize_i32(4),
                Self::Creating => serializer.serialize_i32(5),
                Self::Failed => serializer.serialize_i32(6),
                Self::Deleting => serializer.serialize_i32(7),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.documentai.v1.Processor.State",
            ))
        }
    }
}

/// A processor type is responsible for performing a certain document
/// understanding task on a certain type of document.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProcessorType {
    /// The resource name of the processor type.
    /// Format: `projects/{project}/processorTypes/{processor_type}`
    pub name: std::string::String,

    /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
    pub r#type: std::string::String,

    /// The processor category, used by UI to group processor types.
    pub category: std::string::String,

    /// The locations in which this processor is available.
    pub available_locations: std::vec::Vec<crate::model::processor_type::LocationInfo>,

    /// Whether the processor type allows creation. If true, users can create a
    /// processor of this processor type. Otherwise, users need to request access.
    pub allow_creation: bool,

    /// Launch stage of the processor type
    pub launch_stage: api::model::LaunchStage,

    /// A set of Cloud Storage URIs of sample documents for this processor.
    pub sample_document_uris: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ProcessorType {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ProcessorType::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [r#type][crate::model::ProcessorType::type].
    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [category][crate::model::ProcessorType::category].
    pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.category = v.into();
        self
    }

    /// Sets the value of [available_locations][crate::model::ProcessorType::available_locations].
    pub fn set_available_locations<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::processor_type::LocationInfo>,
    {
        use std::iter::Iterator;
        self.available_locations = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [allow_creation][crate::model::ProcessorType::allow_creation].
    pub fn set_allow_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.allow_creation = v.into();
        self
    }

    /// Sets the value of [launch_stage][crate::model::ProcessorType::launch_stage].
    pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
        mut self,
        v: T,
    ) -> Self {
        self.launch_stage = v.into();
        self
    }

    /// Sets the value of [sample_document_uris][crate::model::ProcessorType::sample_document_uris].
    pub fn set_sample_document_uris<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.sample_document_uris = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ProcessorType {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.documentai.v1.ProcessorType"
    }
}

/// Defines additional types related to [ProcessorType].
pub mod processor_type {
    #[allow(unused_imports)]
    use super::*;

    /// The location information about where the processor is available.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct LocationInfo {
        /// The location ID. For supported locations, refer to [regional and
        /// multi-regional support](/document-ai/docs/regions).
        pub location_id: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl LocationInfo {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [location_id][crate::model::processor_type::LocationInfo::location_id].
        pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.location_id = v.into();
            self
        }
    }

    impl wkt::message::Message for LocationInfo {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.documentai.v1.ProcessorType.LocationInfo"
        }
    }
}
